Quantcast

Moved creation of MainPanel.scroll_frame to just above the creation of MainPanel.progress_bar

torhal [11-27-09 - 23:46]
Moved creation of MainPanel.scroll_frame to just above the creation of MainPanel.progress_bar
Renamed MainPanel.close_button to MainPanel.xclose_button
ARL_CloseButton is now MainPanel.close_button - its creation was moved to the main file body from addon:InitializeFrame()
Moved ClosePopups() and ColourSkillLebel(), and all tooltip-related functions to just before the frame creation code.
Moved the icons in the filter menu more to the left so the text would fit in the panel.
Made various small syntax changes.
Filename
ARLFrame.lua
diff --git a/ARLFrame.lua b/ARLFrame.lua
index 7535b25..06ed68d 100644
--- a/ARLFrame.lua
+++ b/ARLFrame.lua
@@ -197,6 +197,47 @@ do
 end	-- do block

 -------------------------------------------------------------------------------
+-- Close all possible pop-up windows
+-------------------------------------------------------------------------------
+function addon:ClosePopups()
+	StaticPopup_Hide("ARL_NOTSCANNED")
+	StaticPopup_Hide("ARL_ALLFILTERED")
+	StaticPopup_Hide("ARL_ALLKNOWN")
+	StaticPopup_Hide("ARL_ALLEXCLUDED")
+	StaticPopup_Hide("ARL_SEARCHFILTERED")
+end
+
+-------------------------------------------------------------------------------
+-- Colours a skill level based on whether or not the player has a high enough
+-- skill level or faction to learn it.
+-------------------------------------------------------------------------------
+local function ColourSkillLevel(recipeEntry, hasFaction, recStr)
+	local playerSkill = Player["ProfessionLevel"]
+	local recipeSkill = recipeEntry["Level"]
+	local recipeOrange = recipeEntry["Orange"]
+	local recipeYellow = recipeEntry["Yellow"]
+	local recipeGreen = recipeEntry["Green"]
+	local recipeGrey = recipeEntry["Grey"]
+
+	if recipeSkill > playerSkill or not hasFaction then
+		return addon:Red(recStr)
+	elseif playerSkill >= recipeGrey then
+		return addon:MidGrey(recStr)
+	elseif playerSkill >= recipeGreen then
+		return addon:Green(recStr)
+	elseif playerSkill >= recipeYellow then
+		return addon:Yellow(recStr)
+	elseif playerSkill >= recipeOrange then
+		return addon:Orange(recStr)
+	else
+		--@alpha@
+		addon:Print("DEBUG: ColourSkillLevel fallback: " .. recStr)
+		--@end-alpha@
+		return addon:MidGrey(recStr)
+	end
+end
+
+-------------------------------------------------------------------------------
 -- Sets show and hide scripts as well as text for a tooltip for the given frame.
 -------------------------------------------------------------------------------
 local SetTooltipScripts
@@ -485,3926 +526,3884 @@ do
 end	-- do

 -------------------------------------------------------------------------------
--- Create arlSpellTooltip
+-- Tooltip functions and data.
 -------------------------------------------------------------------------------
 local arlSpellTooltip = CreateFrame("GameTooltip", "arlSpellTooltip", UIParent, "GameTooltipTemplate")
+local arlTooltip

--------------------------------------------------------------------------------
--- Create the MainPanel and set its values
--------------------------------------------------------------------------------
-local MainPanel = CreateFrame("Frame", "ARL_MainPanel", UIParent)
-MainPanel:SetWidth(MAINPANEL_NORMAL_WIDTH)
-MainPanel:SetHeight(447)
-MainPanel:SetFrameStrata("DIALOG")
-MainPanel:SetHitRectInsets(5, 5, 5, 5)
-
-MainPanel:EnableMouse(true)
-MainPanel:EnableKeyboard(true)
-MainPanel:SetMovable(true)
-MainPanel:Show()
-
-MainPanel.is_expanded = false
-
--- Let the user banish the MainPanel with the ESC key.
-tinsert(UISpecialFrames, "ARL_MainPanel")
-
-addon.Frame = MainPanel
+-- Font Objects needed for arlTooltip
+local narrowFont
+local normalFont

-MainPanel.backdrop = MainPanel:CreateTexture("AckisRecipeList.bgTexture", "ARTWORK")
-MainPanel.backdrop:SetTexture("Interface\\Addons\\AckisRecipeList\\img\\main")
-MainPanel.backdrop:SetAllPoints(MainPanel)
-MainPanel.backdrop:SetTexCoord(0, (MAINPANEL_NORMAL_WIDTH/512), 0, (447/512))
+local narrowFontObj = CreateFont(MODNAME.."narrowFontObj")
+local normalFontObj = CreateFont(MODNAME.."normalFontObj")

-MainPanel.title_bar = MainPanel:CreateFontString(nil, "ARTWORK")
-MainPanel.title_bar:SetFontObject("GameFontHighlightSmall")
-MainPanel.title_bar:ClearAllPoints()
-MainPanel.title_bar:SetPoint("TOP", MainPanel, "TOP", 20, -16)
-MainPanel.title_bar:SetJustifyH("CENTER")
+-- Fallback in case the user doesn't have LSM-3.0 installed
+if not LibStub:GetLibrary("LibSharedMedia-3.0", true) then

--------------------------------------------------------------------------------
--- MainPanel scripts/functions.
--------------------------------------------------------------------------------
-MainPanel:SetScript("OnHide",
-		    function(self)
-			    addon:ClosePopups()
-		    end)
+	local locale = GetLocale()
+	-- Fix for font issues on koKR
+	if locale == "koKR" then
+		narrowFont = "Fonts\\2002.TTF"
+		normalFont = "Fonts\\2002.TTF"
+	else
+		narrowFont = "Fonts\\ARIALN.TTF"
+		normalFont = "Fonts\\FRIZQT__.TTF"
+	end
+else
+	-- Register LSM 3.0
+	local LSM3 = LibStub("LibSharedMedia-3.0")

-MainPanel:SetScript("OnMouseDown", MainPanel.StartMoving)
+	narrowFont = LSM3:Fetch(LSM3.MediaType.FONT, "Arial Narrow")
+	normalFont = LSM3:Fetch(LSM3.MediaType.FONT, "Friz Quadrata TT")
+end

-MainPanel:SetScript("OnMouseUp",
-		    function(self, button)
-			    self:StopMovingOrSizing()
+-- I want to do a bit more comprehensive tooltip processing. Things like changing font sizes,
+-- adding padding to the left hand side, and using better color handling. So... this function
+-- will do that for me.
+local function ttAdd(
+	leftPad,		-- number of times to pad two spaces on left side
+	textSize,		-- add to or subtract from addon.db.profile.frameopts.fontsize to get fontsize
+	narrow,			-- if 1, use ARIALN instead of FRITZQ
+	str1,			-- left-hand string
+	hexcolor1,		-- hex color code for left-hand side
+	str2,			-- if present, this is the right-hand string
+	hexcolor2)		-- if present, hex color code for right-hand side

-			    local opts = addon.db.profile.frameopts
-			    local from, _, to, x, y = self:GetPoint()
+	-- are we changing fontsize or narrow?
+	local fontSize
+	if ((narrow == 1) or (textSize ~= 0)) then
+		local font, fontObj = normalFont, normalFontObj
+		if (narrow == 1) then
+			font = narrowFont
+			fontObj = narrowFontObj
+		end

-			    opts.anchorFrom = from
-			    opts.anchorTo = to
+		fontSize = addon.db.profile.frameopts.fontsize + textSize

-			    if self.is_expanded then
-				    if opts.anchorFrom == "TOPLEFT" or opts.anchorFrom == "LEFT" or opts.anchorFrom == "BOTTOMLEFT" then
-					    opts.offsetx = x
-				    elseif opts.anchorFrom == "TOP" or opts.anchorFrom == "CENTER" or opts.anchorFrom == "BOTTOM" then
-					    opts.offsetx = x - 151/2
-				    elseif opts.anchorFrom == "TOPRIGHT" or opts.anchorFrom == "RIGHT" or opts.anchorFrom == "BOTTOMRIGHT" then
-					    opts.offsetx = x - 151
-				    end
-			    else
-				    opts.offsetx = x
-			    end
-			    opts.offsety = y
-		    end)
+		fontObj:SetFont(font, fontSize)
+		arlTooltip:SetFont(fontObj)
+	end

-function MainPanel:ToggleState()
-	if self.is_expanded then
-		self:SetWidth(MAINPANEL_NORMAL_WIDTH)
+	-- Add in our left hand padding
+	local loopPad = leftPad
+	local leftStr = str1

-		self.backdrop:SetTexture([[Interface\Addons\AckisRecipeList\img\main]])
-		self.backdrop:SetAllPoints(self)
-		self.backdrop:SetTexCoord(0, (MAINPANEL_NORMAL_WIDTH/512), 0, (447/512))
+	while (loopPad > 0) do
+		leftStr = "  " .. leftStr
+		loopPad = loopPad - 1
+	end
+	local lineNum

-		self.progress_bar:SetWidth(195)
+	if (str2) then
+		lineNum = arlTooltip:AddLine()
+		arlTooltip:SetCell(lineNum, 1, "|cff"..hexcolor1..leftStr.."|r")
+		arlTooltip:SetCell(lineNum, 2, "|cff"..hexcolor2..str2.."|r", "RIGHT")
 	else
-		self:SetWidth(MAINPANEL_EXPANDED_WIDTH)
+		-- Text spans both columns - set maximum width to match fontSize to maintain uniform tooltip size. -Torhal
+		local width = math.ceil(fontSize * 37.5)
+		lineNum = arlTooltip:AddLine()
+		arlTooltip:SetCell(lineNum, 1, "|cff"..hexcolor1..leftStr.."|r", nil, "LEFT", 2, nil, 0, 0, width, width)
+	end
+end

-		self.backdrop:SetTexture([[Interface\Addons\AckisRecipeList\img\expanded]])
-		self.backdrop:SetAllPoints(self)
-		self.backdrop:SetTexCoord(0, (MAINPANEL_EXPANDED_WIDTH/512), 0, (447/512))
+local function SetSpellTooltip(owner, loc, link)
+	arlSpellTooltip:SetOwner(owner, "ANCHOR_NONE")
+	arlSpellTooltip:ClearAllPoints()

-		self.progress_bar:SetWidth(345)
+	if loc == "Top" then
+		arlSpellTooltip:SetPoint("BOTTOMLEFT", owner, "TOPLEFT")
+	elseif loc == "Bottom" then
+		arlSpellTooltip:SetPoint("TOPLEFT", owner, "BOTTOMLEFT")
+	elseif loc == "Left" then
+		arlSpellTooltip:SetPoint("TOPRIGHT", owner, "TOPLEFT")
+	elseif loc == "Right" then
+		arlSpellTooltip:SetPoint("TOPLEFT", owner, "TOPRIGHT")
 	end
-	self.is_expanded = not self.is_expanded

-	local x, y = self:GetLeft(), self:GetBottom()
+	-- Add TipTac Support
+	if TipTac and TipTac.AddModifiedTip and not arlSpellTooltip.tiptac then
+		TipTac:AddModifiedTip(arlSpellTooltip)
+		arlSpellTooltip.tiptac = true
+	end

-	self:ClearAllPoints()
-	self:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", x, y)
-	self:UpdateTitle()
-end
+	-- Set the spell tooltip's scale, and copy its other values from GameTooltip so AddOns which modify it will work.
+	arlSpellTooltip:SetBackdrop(GameTooltip:GetBackdrop())
+	arlSpellTooltip:SetBackdropColor(GameTooltip:GetBackdropColor())
+	arlSpellTooltip:SetBackdropBorderColor(GameTooltip:GetBackdropBorderColor())
+	arlSpellTooltip:SetScale(addon.db.profile.frameopts.tooltipscale)

-function MainPanel:SetProfession()
-	for k, v in pairs(SortedProfessions) do
-		if v.name == Player["Profession"] then
-			self.profession = k
-			break
-		end
-	end
-	self.mode_button:ChangeTexture(SortedProfessions[self.profession].texture)
+	arlSpellTooltip:SetHyperlink(link)
+	arlSpellTooltip:Show()
 end

-function MainPanel:SetPosition()
-	self:ClearAllPoints()
+local function GenerateTooltipContent(owner, rIndex)
+	local spellTooltipLocation = addon.db.profile.spelltooltiplocation
+	local acquireTooltipLocation = addon.db.profile.acquiretooltiplocation
+	local recipe_entry = addon.recipe_list[rIndex]
+	local spellLink = recipe_entry["RecipeLink"]

-	local opts = addon.db.profile.frameopts
-	local FixedOffsetX = opts.offsetx
+	if acquireTooltipLocation == _G.OFF then
+		QTip:Release(arlTooltip)

-	if opts.anchorTo == "" then
-		-- no values yet, clamp to whatever frame is appropriate
-		if ATSWFrame then
-			-- Anchor frame to ATSW
-			self:SetPoint("CENTER", ATSWFrame, "CENTER", 490, 0)
-		elseif CauldronFrame then
-			-- Anchor frame to Cauldron
-			self:SetPoint("CENTER", CauldronFrame, "CENTER", 490, 0)
-		elseif Skillet then
-			-- Anchor frame to Skillet
-			self:SetPoint("CENTER", SkilletFrame, "CENTER", 468, 0)
+		-- If we have the spell link tooltip, anchor it to MainPanel instead so it shows
+		if spellTooltipLocation ~= _G.OFF and spellLink then
+			SetSpellTooltip(MainPanel, spellTooltipLocation, spellLink)
 		else
-			-- Anchor to default tradeskill frame
-			self:SetPoint("TOPLEFT", TradeSkillFrame, "TOPRIGHT", 10, 0)
-		end
-	else
-		if self.is_expanded then
-			if opts.anchorFrom == "TOPLEFT" or opts.anchorFrom == "LEFT" or opts.anchorFrom == "BOTTOMLEFT" then
-				FixedOffsetX = opts.offsetx
-			elseif opts.anchorFrom == "TOP" or opts.anchorFrom == "CENTER" or opts.anchorFrom == "BOTTOM" then
-				FixedOffsetX = opts.offsetx + 151/2
-			elseif opts.anchorFrom == "TOPRIGHT" or opts.anchorFrom == "RIGHT" or opts.anchorFrom == "BOTTOMRIGHT" then
-				FixedOffsetX = opts.offsetx + 151
-			end
+			arlSpellTooltip:Hide()
 		end
-		self:SetPoint(opts.anchorFrom, UIParent, opts.anchorTo, FixedOffsetX, opts.offsety)
+		return
 	end
-end
+	arlTooltip = QTip:Acquire(MODNAME.." Tooltip", 2, "LEFT", "LEFT")
+	arlTooltip:ClearAllPoints()

-function MainPanel:UpdateTitle()
-	if self.is_expanded then
-		local total, active = 0, 0
+	if acquireTooltipLocation == "Right" then
+		arlTooltip:SetPoint("TOPLEFT", MainPanel, "TOPRIGHT")
+	elseif acquireTooltipLocation == "Left" then
+		arlTooltip:SetPoint("TOPRIGHT", MainPanel, "TOPLEFT")
+	elseif acquireTooltipLocation == "Top" then
+		arlTooltip:SetPoint("BOTTOMLEFT", MainPanel, "TOPLEFT")
+	elseif acquireTooltipLocation == "Bottom" then
+		arlTooltip:SetPoint("TOPLEFT", MainPanel, "BOTTOMLEFT")
+	elseif acquireTooltipLocation == "Mouse" then
+		local x, y = GetCursorPosition()
+		local uiscale = UIParent:GetEffectiveScale()

-		for filter, info in pairs(FilterValueMap) do
-			if info.svroot then
-				if info.svroot[filter] == true then
-					active = active + 1
-				end
-				total = total + 1
-			end
-		end
-		self.title_bar:SetFormattedText(addon:Normal("ARL (v.%s) - %s (%d/%d %s)"), addon.version, Player["Profession"], active, total, _G.FILTERS)
-	else
-		self.title_bar:SetFormattedText(addon:Normal("ARL (v.%s) - %s"), addon.version, Player["Profession"])
+		arlTooltip:ClearAllPoints()
+		arlTooltip:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", x / uiscale, y / uiscale)
 	end
-end

--------------------------------------------------------------------------------
--- Create the MainPanel.mode_button and assign its values.
--------------------------------------------------------------------------------
-MainPanel.mode_button = CreateFrame("Button", nil, MainPanel, "UIPanelButtonTemplate")
-MainPanel.mode_button:SetWidth(64)
-MainPanel.mode_button:SetHeight(64)
-MainPanel.mode_button:SetPoint("TOPLEFT", MainPanel, "TOPLEFT", 1, -2)
-MainPanel.mode_button:RegisterForClicks("LeftButtonUp", "RightButtonUp")
+	if TipTac and TipTac.AddModifiedTip then
+		-- Pass true as second parameter because hooking OnHide causes C stack overflows -Torhal
+		TipTac:AddModifiedTip(arlTooltip, true)
+	end
+	local clr1, clr2 = "", ""

-MainPanel.mode_button._normal = MainPanel.mode_button:CreateTexture(nil, "BACKGROUND")
-MainPanel.mode_button._pushed = MainPanel.mode_button:CreateTexture(nil, "BACKGROUND")
-MainPanel.mode_button._disabled = MainPanel.mode_button:CreateTexture(nil, "BACKGROUND")
+	arlTooltip:Clear()
+	arlTooltip:SetScale(addon.db.profile.frameopts.tooltipscale)
+	arlTooltip:AddHeader()
+	arlTooltip:SetCell(1, 1, "|cff"..addon:hexcolor("HIGH")..recipe_entry["Name"], "CENTER", 2)

--------------------------------------------------------------------------------
--- MainPanel.mode_button scripts/functions.
--------------------------------------------------------------------------------
-MainPanel.mode_button:SetScript("OnClick",
-				function(self, button, down)
-					-- Known professions should be in Player["Professions"]
+	-- check if the recipe is excluded
+	local exclude = addon.db.profile.exclusionlist

-					-- This loop is gonna be weird. The reason is because we need to
-					-- ensure that we cycle through all the known professions, but also
-					-- that we do so in order. That means that if the currently displayed
-					-- profession is the last one in the list, we're actually going to
-					-- iterate completely once to get to the currently displayed profession
-					-- and then iterate again to make sure we display the next one in line.
-					-- Further, there is the nuance that the person may not know any
-					-- professions yet at all. User are so annoying.
-					local startLoop = 0
-					local endLoop = 0
-					local displayProf = 0
+	if exclude[rIndex] then
+		ttAdd(0, -1, 1, L["RECIPE_EXCLUDED"], addon:hexcolor("RED"))
+	end

-					-- ok, so first off, if we've never done this before, there is no "current"
-					-- and a single iteration will do nicely, thank you
-					if button == "LeftButton" then
-						-- normal profession switch
-						if MainPanel.profession == 0 then
-							startLoop = 1
-							endLoop = NUM_PROFESSIONS + 1
-						else
-							startLoop = MainPanel.profession + 1
-							endLoop = MainPanel.profession
-						end
-						local index = startLoop
-
-						while index ~= endLoop do
-							if index > NUM_PROFESSIONS then
-								index = 1
-							elseif Player["Professions"][SortedProfessions[index].name] then
-								displayProf = index
-								MainPanel.profession = index
-								break
-							else
-								index = index + 1
-							end
-						end
-					elseif button == "RightButton" then
-						-- reverse profession switch
-						if MainPanel.profession == 0 then
-							startLoop = NUM_PROFESSIONS + 1
-							endLoop = 0
-						else
-							startLoop = MainPanel.profession - 1
-							endLoop = MainPanel.profession
-						end
-						local index = startLoop
+	-- Add in skill level requirement, colored correctly
+	clr1 = addon:hexcolor("NORMAL")

-						while index ~= endLoop do
-							if index < 1 then
-								index = NUM_PROFESSIONS
-							elseif Player["Professions"][SortedProfessions[index].name] then
-								displayProf = index
-								MainPanel.profession = index
-								break
-							else
-								index = index - 1
-							end
-						end
-					end
-					local is_shown = TradeSkillFrame:IsVisible()
+	local recipeSkill = recipe_entry["Level"]
+	local playerSkill = Player["ProfessionLevel"]

-					CastSpellByName(SortedProfessions[MainPanel.profession].name)
-					addon:Scan()
+	if recipeSkill > playerSkill then
+		clr2 = addon:hexcolor("RED")
+	elseif playerSkill - recipeSkill < 20 then
+		clr2 = addon:hexcolor("ORANGE")
+	elseif playerSkill - recipeSkill < 30 then
+		clr2 = addon:hexcolor("YELLOW")
+	elseif playerSkill - recipeSkill < 40 then
+		clr2 = addon:hexcolor("GREEN")
+	else
+		clr2 = addon:hexcolor("MIDGREY")
+	end
+	ttAdd(0, -1, 0, L["Required Skill"] .. " :", clr1, recipe_entry["Level"], clr2)
+	arlTooltip:AddSeparator()
+	-- Binding info
+	clr1 = addon:hexcolor("NORMAL")

-					if not is_shown then
-						TradeSkillFrame:Hide()
-					end
-				end)
+	if (recipe_entry["Flags"][36]) then
+		ttAdd(0, -1, 1, L["BOEFilter"], clr1)
+	end

-function MainPanel.mode_button:ChangeTexture(texture)
-	local normal, pushed, disabled = self._normal, self._pushed, self._disabled
+	if (recipe_entry["Flags"][37]) then
+		ttAdd(0, -1, 1, L["BOPFilter"], clr1)
+	end

-	normal:SetTexture([[Interface\Addons\AckisRecipeList\img\]] .. texture .. [[_up]])
-	normal:SetTexCoord(0, 1, 0, 1)
-	normal:SetAllPoints(self)
-	self:SetNormalTexture(normal)
+	if (recipe_entry["Flags"][38]) then
+		ttAdd(0, -1, 1, L["BOAFilter"], clr1)
+	end

-	pushed:SetTexture([[Interface\Addons\AckisRecipeList\img\]] .. texture .. [[_down]])
-	pushed:SetTexCoord(0, 1, 0, 1)
-	pushed:SetAllPoints(self)
-	self:SetPushedTexture(pushed)
+	if (recipe_entry["Flags"][40]) then
+		ttAdd(0, -1, 1, L["RecipeBOEFilter"], clr1)
+	end

-	disabled:SetTexture([[Interface\Addons\AckisRecipeList\img\]] .. texture .. [[_up]])
-	disabled:SetTexCoord(0, 1, 0, 1)
-	disabled:SetAllPoints(self)
-	self:SetDisabledTexture(disabled)
-end
+	if (recipe_entry["Flags"][41]) then
+		ttAdd(0, -1, 1, L["RecipeBOPFilter"], clr1)
+	end

--------------------------------------------------------------------------------
--- Create the X-close button, and set its scripts.
--------------------------------------------------------------------------------
-MainPanel.close_button = CreateFrame("Button", nil, MainPanel, "UIPanelCloseButton")
-MainPanel.close_button:SetPoint("TOPRIGHT", MainPanel, "TOPRIGHT", 5, -6)
+	if (recipe_entry["Flags"][42]) then
+		ttAdd(0, -1, 1, L["RecipeBOAFilter"], clr1)
+	end
+	arlTooltip:AddSeparator()

-MainPanel.close_button:SetScript("OnClick",
-				 function(self, button, down)
-					 MainPanel:Hide()
-				 end)
+	-- obtain info
+	ttAdd(0, -1, 0, L["Obtained From"] .. " : ", addon:hexcolor("NORMAL"))

--------------------------------------------------------------------------------
--- Create MainPanel.filter_toggle, and set its scripts.
--------------------------------------------------------------------------------
-MainPanel.filter_toggle = GenericCreateButton(nil, MainPanel, 25, 90, "GameFontNormalSmall", "GameFontHighlightSmall", L["FILTER_OPEN"], "CENTER", L["FILTER_OPEN_DESC"], 1)
-MainPanel.filter_toggle:SetPoint("TOPRIGHT", MainPanel, "TOPRIGHT", -8, -40)
+	local playerFaction = Player["Faction"]
+	local rep_list = addon.reputation_list

-MainPanel.filter_toggle:SetScript("OnClick",
-			   function(self, button, down)
-				   if MainPanel.is_expanded then
-					   -- Change the text and tooltip for the filter button
-					   self:SetText(L["FILTER_OPEN"])
-					   SetTooltipScripts(self, L["FILTER_OPEN_DESC"])
+	-- loop through acquire methods, display each
+	for k, v in pairs(recipe_entry["Acquire"]) do
+		local acquire_type = v["Type"]

-					   -- Hide my 7 buttons
-					   ARL_ExpGeneralOptCB:Hide()
-					   ARL_ExpObtainOptCB:Hide()
-					   ARL_ExpBindingOptCB:Hide()
-					   ARL_ExpItemOptCB:Hide()
-					   ARL_ExpPlayerOptCB:Hide()
-					   ARL_ExpRepOptCB:Hide()
-					   ARL_ExpMiscOptCB:Hide()
+		if acquire_type == A_TRAINER then
+			-- Trainer:			TrainerName
+			-- TrainerZone			TrainerCoords
+			local trnr = addon.trainer_list[v["ID"]]
+			local cStr = ""

-					   -- Uncheck the seven buttons
-					   HideARL_ExpOptCB()
+			clr1 = addon:hexcolor("TRAINER")
+			-- Don't display trainers if it's opposite faction
+			local displaytt = false

-					   MainPanel.filter_menu:Hide()
-					   MainPanel.filter_reset:Hide()
-				   else
-					   -- Change the text and tooltip for the filter button
-					   self:SetText(L["FILTER_CLOSE"])
-					   SetTooltipScripts(self, L["FILTER_CLOSE_DESC"])
+			if (trnr["Faction"] == FACTION_HORDE) then
+				clr2 = addon:hexcolor("HORDE")

-					   -- Show my 7 buttons
-					   ARL_ExpGeneralOptCB:Show()
-					   ARL_ExpObtainOptCB:Show()
-					   ARL_ExpBindingOptCB:Show()
-					   ARL_ExpItemOptCB:Show()
-					   ARL_ExpPlayerOptCB:Show()
-					   ARL_ExpRepOptCB:Show()
-					   ARL_ExpMiscOptCB:Show()
+				if (playerFaction == FACTION_HORDE) then
+					displaytt = true
+				end
+			elseif (trnr["Faction"] == FACTION_ALLIANCE) then
+				clr2 = addon:hexcolor("ALLIANCE")

-					   MainPanel.filter_reset:Show()
-				   end
-				   MainPanel:ToggleState()
-			   end)
+				if (playerFaction == FACTION_ALLIANCE) then
+					displaytt = true
+				end
+			else
+				clr2 = addon:hexcolor("NEUTRAL")
+				displaytt = true
+			end

--------------------------------------------------------------------------------
--- Create MainPanel.filter_menu and set its scripts.
--------------------------------------------------------------------------------
-MainPanel.filter_menu = CreateFrame("Frame", "ARL_FilterMenu", MainPanel)
-MainPanel.filter_menu:SetWidth(FILTERMENU_DOUBLE_WIDTH)
-MainPanel.filter_menu:SetHeight(FILTERMENU_HEIGHT)
-MainPanel.filter_menu:SetPoint("TOPLEFT", MainPanel, "TOPRIGHT", -6, -102)
-MainPanel.filter_menu:EnableMouse(true)
-MainPanel.filter_menu:EnableKeyboard(true)
-MainPanel.filter_menu:SetMovable(false)
-MainPanel.filter_menu:SetHitRectInsets(5, 5, 5, 5)
-MainPanel.filter_menu:Hide()
+			if (displaytt) then
+				-- Add the trainer information to the tooltip
+				ttAdd(0, -2, 0, L["Trainer"], clr1, trnr["Name"], clr2)
+				-- If we have a coordinate, add the coordinates to the tooltop
+				if (trnr["Coordx"] ~= 0) and (trnr["Coordy"] ~= 0) then
+					cStr = "(" .. trnr["Coordx"] .. ", " .. trnr["Coordy"] .. ")"
+				end
+				clr1 = addon:hexcolor("NORMAL")
+				clr2 = addon:hexcolor("HIGH")
+				ttAdd(1, -2, 1, trnr["Location"], clr1, cStr, clr2)
+			end
+		elseif acquire_type == A_VENDOR then
+			-- Vendor:					VendorName
+			-- VendorZone				VendorCoords
+			local vendor = addon.vendor_list[v["ID"]]
+			local cStr = ""

--- Set all the current options in the filter menu to make sure they are consistent with the SV options.
-MainPanel.filter_menu:SetScript("OnShow",
-				function()
-					for filter, info in pairs(FilterValueMap) do
-						if info.svroot then
-							info.cb:SetChecked(info.svroot[filter])
-						end
-					end
-					-- Miscellaneous Options
-					ARL_IgnoreCB:SetChecked(addon.db.profile.ignoreexclusionlist)
-				end)
+			clr1 = addon:hexcolor("VENDOR")
+			-- Don't display vendors of opposite faction
+			local displaytt = false
+			local faction

-MainPanel.filter_menu.texture = MainPanel.filter_menu:CreateTexture(nil, "ARTWORK")
-MainPanel.filter_menu.texture:SetTexture("Interface\\Addons\\AckisRecipeList\\img\\fly_2col")
-MainPanel.filter_menu.texture:SetAllPoints(MainPanel.filter_menu)
-MainPanel.filter_menu.texture:SetTexCoord(0, (FILTERMENU_DOUBLE_WIDTH/256), 0, (FILTERMENU_HEIGHT/512))
+			if (vendor["Faction"] == FACTION_HORDE) then
+				clr2 = addon:hexcolor("HORDE")
+				if (playerFaction == FACTION_HORDE) then
+					displaytt = true
+				else
+					faction = FACTION_HORDE
+				end
+			elseif (vendor["Faction"] == FACTION_ALLIANCE) then
+				clr2 = addon:hexcolor("ALLIANCE")
+				if (playerFaction == FACTION_ALLIANCE) then
+					displaytt = true
+				else
+					faction = FACTION_ALLIANCE
+				end
+			else
+				clr2 = addon:hexcolor("NEUTRAL")
+				displaytt = true
+			end

--------------------------------------------------------------------------------
--- Create MainPanel.filter_reset and set its scripts.
--------------------------------------------------------------------------------
-MainPanel.filter_reset = GenericCreateButton(nil, MainPanel, 25, 90, "GameFontNormalSmall", "GameFontHighlightSmall", _G.RESET, "CENTER",
-					     L["RESET_DESC"], 1)
-MainPanel.filter_reset:SetPoint("TOPRIGHT", MainPanel.filter_toggle, "BOTTOMRIGHT", 0, -2)
-MainPanel.filter_reset:Hide()
+			if displaytt then
+				if (vendor["Coordx"] ~= 0) and (vendor["Coordy"] ~= 0) then
+					cStr = "(" .. vendor["Coordx"] .. ", " .. vendor["Coordy"] .. ")"
+				end

-do
-	local function recursiveReset(t)
-		-- Thanks to Antiarc for this code
-		for k, v in pairs(t) do
-			if type(v) == "table" then
-				recursiveReset(v)
-			else
-				t[k] = true
+				ttAdd(0, -1, 0, L["Vendor"], clr1, vendor["Name"], clr2)
+				clr1 = addon:hexcolor("NORMAL")
+				clr2 = addon:hexcolor("HIGH")
+				ttAdd(1, -2, 1, vendor["Location"], clr1, cStr, clr2)
+			elseif faction then
+				ttAdd(0, -1, 0, faction.." "..L["Vendor"], clr1)
 			end
-		end
-	end
+		elseif acquire_type == A_MOB then
+			-- Mob Drop:			Mob Name
+			-- MoBZ				MobCoords
+			local mob = addon.mob_list[v["ID"]]
+			local cStr = ""

-	MainPanel.filter_reset:SetScript("OnClick",
-					 function()
-						 local filterdb = addon.db.profile.filters
+			if (mob["Coordx"] ~= 0) and (mob["Coordy"] ~= 0) then
+				cStr = "(" .. mob["Coordx"] .. ", " .. mob["Coordy"] .. ")"
+			end

-						 -- Reset all filters to true
-						 recursiveReset(addon.db.profile.filters)
+			clr1 = addon:hexcolor("MOBDROP")
+			clr2 = addon:hexcolor("HORDE")
+			ttAdd(0, -1, 0, L["Mob Drop"], clr1, mob["Name"], clr2)
+			clr1 = addon:hexcolor("NORMAL")
+			clr2 = addon:hexcolor("HIGH")
+			ttAdd(1, -2, 1, mob["Location"], clr1, cStr, clr2)
+		elseif acquire_type == A_QUEST then
+			-- Quest:				QuestName
+			-- QuestZone				QuestCoords
+			local quest = addon.quest_list[v["ID"]]

-						 -- Reset specific filters to false
-						 filterdb.general.specialty = false
-						 filterdb.general.known = false
+			if quest then
+				clr1 = addon:hexcolor("QUEST")
+				-- Don't display quests of opposite faction
+				local displaytt = false
+				local faction

-						 -- Reset all classes to false
-						 for class in pairs(filterdb.classes) do
-							 filterdb.classes[class] = false
-						 end
-						 -- Set your own class to true
-						 filterdb.classes[strlower(Player["Class"])] = true
+				if (quest["Faction"] == FACTION_HORDE) then
+					clr2 = addon:hexcolor("HORDE")
+					if (playerFaction == FACTION_HORDE) then
+						displaytt = true
+					else
+						faction = FACTION_HORDE
+					end
+				elseif (quest["Faction"] == FACTION_ALLIANCE) then
+					clr2 = addon:hexcolor("ALLIANCE")
+					if (playerFaction == FACTION_ALLIANCE) then
+						displaytt = true
+					else
+						faction = FACTION_ALLIANCE
+					end
+				else
+					clr2 = addon:hexcolor("NEUTRAL")
+					displaytt = true
+				end

-						 if MainPanel:IsVisible() then
-							 MainPanel:UpdateTitle()
-							 HideARL_ExpOptCB()
-							 MainPanel.filter_menu:Hide()
-							 ReDisplay()
-						 end
-					 end)
-end	-- do
+				if displaytt then
+					local cStr = ""

--------------------------------------------------------------------------------
--- Create MainPanel.progress_bar and set its scripts
--------------------------------------------------------------------------------
-do
-	-- Default values for the progressbar
-	local pbMin = 0
-	local pbMax = 100
-	local pbCur = 50
+					if (quest["Coordx"] ~= 0) and (quest["Coordy"] ~= 0) then
+						cStr = "(" .. quest["Coordx"] .. ", " .. quest["Coordy"] .. ")"
+					end

-	MainPanel.progress_bar = CreateFrame("StatusBar", nil, MainPanel)
-	MainPanel.progress_bar:SetWidth(195)
-	MainPanel.progress_bar:SetHeight(14)
-	MainPanel.progress_bar:ClearAllPoints()
-	MainPanel.progress_bar:SetPoint("BOTTOMLEFT", MainPanel, 17, 7)
-	MainPanel.progress_bar:SetStatusBarTexture("Interface\\Addons\\AckisRecipeList\\img\\progressbar")
-	MainPanel.progress_bar:SetOrientation("HORIZONTAL")
-	MainPanel.progress_bar:SetStatusBarColor(0.25, 0.25, 0.75)
-	MainPanel.progress_bar:SetMinMaxValues(pbMin, pbMax)
-	MainPanel.progress_bar:SetValue(pbCur)
+					ttAdd(0, -1, 0, L["Quest"], clr1, quest["Name"], clr2)
+					clr1 = addon:hexcolor("NORMAL")
+					clr2 = addon:hexcolor("HIGH")
+					ttAdd(1, -2, 1, quest["Location"], clr1, cStr, clr2)
+				elseif faction then
+					ttAdd(0, -1, 0, faction.." "..L["Quest"], clr1)
+				end
+			end
+		elseif acquire_type == A_SEASONAL then
+			-- Seasonal:				SeasonEventName
+			clr1 = addon:hexcolor("SEASON")
+			ttAdd(0, -1, 0, SEASONAL_CATEGORY, clr1, addon.seasonal_list[v["ID"]]["Name"], clr1)
+		elseif acquire_type == A_REPUTATION then
+			-- Reputation:				Faction
+			-- RepLevel				RepVendor
+			-- RepVendorZone			RepVendorCoords

-	MainPanel.progress_bar.text = MainPanel.progress_bar:CreateFontString(nil, "ARTWORK")
-	MainPanel.progress_bar.text:SetWidth(195)
-	MainPanel.progress_bar.text:SetHeight(14)
-	MainPanel.progress_bar.text:SetFontObject("GameFontHighlightSmall")
-	MainPanel.progress_bar.text:ClearAllPoints()
-	MainPanel.progress_bar.text:SetPoint("CENTER", MainPanel.progress_bar, "CENTER", 0, 0)
-	MainPanel.progress_bar.text:SetJustifyH("CENTER")
-	MainPanel.progress_bar.text:SetFormattedText("%d / %d - %d%%", pbCur, pbMax, floor(pbCur / pbMax * 100))
-end	-- do
+			local repfac = rep_list[v["ID"]]
+			local repname = repfac["Name"] -- name
+			local rplvl = v["RepLevel"]
+			local repvendor = addon.vendor_list[v["RepVendor"]]
+			local cStr = ""

-function MainPanel.progress_bar:Update()
-	local pbCur, pbMax
-	local settings = addon.db.profile
+			if (repvendor["Coordx"] ~= 0) and (repvendor["Coordy"] ~= 0) then
+				cStr = "(" .. repvendor["Coordx"] .. ", " .. repvendor["Coordy"] .. ")"
+			end
+			clr1 = addon:hexcolor("REP")
+			clr2 = addon:hexcolor("NORMAL")
+			ttAdd(0, -1, 0, _G.REPUTATION, clr1, repname, clr2)

-	if settings.includefiltered then
-		pbCur = Player.recipes_known
-		pbMax = Player.recipes_total
-	else
-		-- We're removing filtered recipes from the final count
-		pbCur = Player.recipes_known_filtered
-		pbMax = Player.recipes_total_filtered
-	end
+			local rStr = ""
+			if (rplvl == 0) then
+				rStr = FACTION_NEUTRAL
+				clr1 = addon:hexcolor("NEUTRAL")
+			elseif (rplvl == 1) then
+				rStr = BFAC["Friendly"]
+				clr1 = addon:hexcolor("FRIENDLY")
+			elseif (rplvl == 2) then
+				rStr = BFAC["Honored"]
+				clr1 = addon:hexcolor("HONORED")
+			elseif (rplvl == 3) then
+				rStr = BFAC["Revered"]
+				clr1 = addon:hexcolor("REVERED")
+			else
+				rStr = BFAC["Exalted"]
+				clr1 = addon:hexcolor("EXALTED")
+			end

-	if not settings.includeexcluded and not settings.ignoreexclusionlist then
-		pbCur = pbCur - Player.excluded_recipes_unknown
-		pbMax = pbMax - Player.excluded_recipes_known
-	end
-	self:SetMinMaxValues(0, pbMax)
-	self:SetValue(pbCur)
+			local displaytt = false
+			if repvendor["Faction"] == FACTION_HORDE then
+				clr2 = addon:hexcolor("HORDE")

-	if (floor(pbCur / pbMax * 100) < 101) and pbCur >= 0 and pbMax >= 0 then
-		self.text:SetFormattedText("%d / %d - %d%%", pbCur, pbMax, floor(pbCur / pbMax * 100))
-	else
-		self.text:SetFormattedText("0 / 0 - %s", L["NOT_YET_SCANNED"])
-	end
-end
+				if playerFaction == FACTION_HORDE then
+					displaytt = true
+				end
+			elseif repvendor["Faction"] == FACTION_ALLIANCE then
+				clr2 = addon:hexcolor("ALLIANCE")

--------------------------------------------------------------------------------
--- Close all possible pop-up windows
--------------------------------------------------------------------------------
-function addon:ClosePopups()
-	StaticPopup_Hide("ARL_NOTSCANNED")
-	StaticPopup_Hide("ARL_ALLFILTERED")
-	StaticPopup_Hide("ARL_ALLKNOWN")
-	StaticPopup_Hide("ARL_ALLEXCLUDED")
-	StaticPopup_Hide("ARL_SEARCHFILTERED")
-end
+				if playerFaction == FACTION_ALLIANCE then
+					displaytt = true
+				end
+			else
+				clr2 = addon:hexcolor("NEUTRAL")
+				displaytt = true
+			end

--------------------------------------------------------------------------------
--- Colours a skill level based on whether or not the player has a high enough
--- skill level or faction to learn it.
--------------------------------------------------------------------------------
-local function ColourSkillLevel(recipeEntry, hasFaction, recStr)
-	local playerSkill = Player["ProfessionLevel"]
-	local recipeSkill = recipeEntry["Level"]
-	local recipeOrange = recipeEntry["Orange"]
-	local recipeYellow = recipeEntry["Yellow"]
-	local recipeGreen = recipeEntry["Green"]
-	local recipeGrey = recipeEntry["Grey"]
+			if displaytt then
+				ttAdd(1, -2, 0, rStr, clr1, repvendor["Name"], clr2)
+				clr1 = addon:hexcolor("NORMAL")
+				clr2 = addon:hexcolor("HIGH")
+				ttAdd(2, -2, 1, repvendor["Location"], clr1, cStr, clr2)
+			end
+		elseif acquire_type == A_WORLD_DROP then
+			-- World Drop				RarityLevel
+			if (v["ID"] == 1) then
+				clr1 = addon:hexcolor("COMMON")
+			elseif (v["ID"] == 2) then
+				clr1 = addon:hexcolor("UNCOMMON")
+			elseif (v["ID"] == 3) then
+				clr1 = addon:hexcolor("RARE")
+			elseif (v["ID"] == 4) then
+				clr1 = addon:hexcolor("EPIC")
+			else
+				clr1 = addon:hexcolor("NORMAL")
+			end
+			ttAdd(0, -1, 0, L["World Drop"], clr1)
+		elseif acquire_type == A_CUSTOM then
+			local customname = addon.custom_list[v["ID"]]["Name"]

-	if recipeSkill > playerSkill or not hasFaction then
-		return addon:Red(recStr)
-	elseif playerSkill >= recipeGrey then
-		return addon:MidGrey(recStr)
-	elseif playerSkill >= recipeGreen then
-		return addon:Green(recStr)
-	elseif playerSkill >= recipeYellow then
-		return addon:Yellow(recStr)
-	elseif playerSkill >= recipeOrange then
-		return addon:Orange(recStr)
-	else
+			ttAdd(0, -1, 0, customname, addon:hexcolor("NORMAL"))
+		elseif acquire_type == A_PVP then
+			-- Vendor:					VendorName
+			-- VendorZone				VendorCoords
+			local vendor = addon.vendor_list[v["ID"]]
+			local cStr = ""
+
+			clr1 = addon:hexcolor("VENDOR")
+			-- Don't display vendors of opposite faction
+			local displaytt = false
+			local faction
+
+			if (vendor["Faction"] == FACTION_HORDE) then
+				clr2 = addon:hexcolor("HORDE")
+				if (playerFaction == FACTION_HORDE) then
+					displaytt = true
+				else
+					faction = FACTION_HORDE
+				end
+			elseif (vendor["Faction"] == FACTION_ALLIANCE) then
+				clr2 = addon:hexcolor("ALLIANCE")
+				if (playerFaction == FACTION_ALLIANCE) then
+					displaytt = true
+				else
+					faction = FACTION_ALLIANCE
+				end
+			else
+				clr2 = addon:hexcolor("NEUTRAL")
+				displaytt = true
+			end
+
+			if displaytt then
+				if vendor["Coordx"] ~= 0 and vendor["Coordy"] ~= 0 then
+					cStr = "(" .. vendor["Coordx"] .. ", " .. vendor["Coordy"] .. ")"
+				end
+				ttAdd(0, -1, 0, L["Vendor"], clr1, vendor["Name"], clr2)
+				clr1 = addon:hexcolor("NORMAL")
+				clr2 = addon:hexcolor("HIGH")
+				ttAdd(1, -2, 1, vendor["Location"], clr1, cStr, clr2)
+			elseif faction then
+				ttAdd(0, -1, 0, faction.." "..L["Vendor"], clr1)
+			end
 		--@alpha@
-		addon:Print("DEBUG: ColourSkillLevel fallback: " .. recStr)
+		else	-- Unhandled
+			ttAdd(0, -1, 0, L["Unhandled Recipe"], addon:hexcolor("NORMAL"))
 		--@end-alpha@
-		return addon:MidGrey(recStr)
+		end
+	end
+	arlTooltip:AddSeparator()
+	arlTooltip:AddSeparator()
+
+	clr1 = addon:hexcolor("NORMAL")
+
+	ttAdd(0, -1, 0, L["ALT_CLICK"], clr1)
+	ttAdd(0, -1, 0, L["CTRL_CLICK"], clr1)
+	ttAdd(0, -1, 0, L["SHIFT_CLICK"], clr1)
+
+	if addon.db.profile.worldmap or addon.db.profile.minimap then
+		ttAdd(0, -1, 0, L["CTRL_SHIFT_CLICK"], clr1)
+	end
+	arlTooltip:Show()
+
+	-- If we have the spell link tooltip, link it to the acquire tooltip.
+	if spellTooltipLocation ~= _G.OFF and spellLink then
+		SetSpellTooltip(arlTooltip, spellTooltipLocation, spellLink)
+	else
+		arlSpellTooltip:Hide()
 	end
 end

 -------------------------------------------------------------------------------
--- Map waypoint code.
+-- Create the MainPanel and set its values
 -------------------------------------------------------------------------------
-do
-	local function LoadZones(c, y, ...)
-		-- Fill up the list for normal lookup
-		for i = 1, select('#', ...),1 do
-			c[i] = select(i,...)
-		end
-		-- Reverse lookup to make work easier later on
-		for i in pairs(c) do
-			y[c[i]] = i
-		end
-	end
+local MainPanel = CreateFrame("Frame", "ARL_MainPanel", UIParent)
+MainPanel:SetWidth(MAINPANEL_NORMAL_WIDTH)
+MainPanel:SetHeight(447)
+MainPanel:SetFrameStrata("DIALOG")
+MainPanel:SetHitRectInsets(5, 5, 5, 5)

-	local C1 = {}
-	local C2 = {}
-	local C3 = {}
-	local C4 = {}
-	local c1 = {}
-	local c2 = {}
-	local c3 = {}
-	local c4 = {}
+MainPanel:EnableMouse(true)
+MainPanel:EnableKeyboard(true)
+MainPanel:SetMovable(true)
+MainPanel:Show()

-	LoadZones(C1, c1, GetMapZones(1))
-	LoadZones(C2, c2, GetMapZones(2))
-	LoadZones(C3, c3, GetMapZones(3))
-	LoadZones(C4, c4, GetMapZones(4))
+MainPanel.is_expanded = false

-	local iconlist = {}
+-- Let the user banish the MainPanel with the ESC key.
+tinsert(UISpecialFrames, "ARL_MainPanel")

-	-- Clears all the icons from the world map and the mini-map
-	function addon:ClearMap()
-		if TomTom then
-			for i in pairs(iconlist) do
-				TomTom:RemoveWaypoint(iconlist[i])
-			end
-			iconlist = twipe(iconlist)
-		end
+addon.Frame = MainPanel

-	end
+MainPanel.backdrop = MainPanel:CreateTexture("AckisRecipeList.bgTexture", "ARTWORK")
+MainPanel.backdrop:SetTexture("Interface\\Addons\\AckisRecipeList\\img\\main")
+MainPanel.backdrop:SetAllPoints(MainPanel)
+MainPanel.backdrop:SetTexCoord(0, (MAINPANEL_NORMAL_WIDTH/512), 0, (447/512))

-	local function CheckMapDisplay(acquire_entry, flags)
-		local maptrainer = addon.db.profile.maptrainer
-		local mapquest = addon.db.profile.mapquest
-		local mapvendor = addon.db.profile.mapvendor
-		local mapmob = addon.db.profile.mapmob
-		local player_faction = Player["Faction"]
-		local acquire_type = acquire_entry["Type"]
-		local acquire_id = acquire_entry["ID"]
-		local display = false
+MainPanel.title_bar = MainPanel:CreateFontString(nil, "ARTWORK")
+MainPanel.title_bar:SetFontObject("GameFontHighlightSmall")
+MainPanel.title_bar:ClearAllPoints()
+MainPanel.title_bar:SetPoint("TOP", MainPanel, "TOP", 20, -16)
+MainPanel.title_bar:SetJustifyH("CENTER")

-		-- Trainers - Display if it's your faction or neutral.
-		if maptrainer then
-			if acquire_type == A_TRAINER then
-				local trainer = addon.trainer_list[acquire_id]
+-------------------------------------------------------------------------------
+-- MainPanel scripts/functions.
+-------------------------------------------------------------------------------
+MainPanel:SetScript("OnHide",
+		    function(self)
+			    addon:ClosePopups()
+		    end)

-				display = (trainer["Faction"] == BFAC[player_faction] or trainer["Faction"] == FACTION_NEUTRAL)
-			elseif acquire_type == A_CUSTOM and flags[3] then
-				return true
-			end
-			-- Vendors - Display if it's your faction or neutral
-		elseif mapvendor then
-			if acquire_type == A_VENDOR then
-				local vendor = addon.vendor_list[acquire_id]
+MainPanel:SetScript("OnMouseDown", MainPanel.StartMoving)

-				display = (vendor["Faction"] == BFAC[player_faction] or vendor["Faction"] == FACTION_NEUTRAL)
-			elseif acquire_type == A_CUSTOM and flags[4] then
-				return true
-			end
-			-- Always display mobs
-		elseif (acquire_type == A_MOB and mapmob) or
-			(acquire_type == A_CUSTOM and (flags[5] or flags[6] or flags[10] or flags[11])) then
-			return true
-		-- Quests
-		elseif mapquest then
-			if acquire_type == A_QUEST then
-				local quest = addon.quest_list[acquire_id]
-				display = (quest["Faction"] == BFAC[player_faction] or quest["Faction"] == FACTION_NEUTRAL)
-			elseif acquire_type == A_CUSTOM and flags[8] then
-				return true
-			end
-		end
-		return display
-	end
+MainPanel:SetScript("OnMouseUp",
+		    function(self, button)
+			    self:StopMovingOrSizing()

-	local BZ = LibStub("LibBabble-Zone-3.0"):GetLookupTable()
+			    local opts = addon.db.profile.frameopts
+			    local from, _, to, x, y = self:GetPoint()

-	local INSTANCE_LOCATIONS = {
-		[BZ["Ahn'kahet: The Old Kingdom"]] = {
-			["loc"] = c1[BZ["Dragonblight"]],
-			["c"] = 4,
-		},
-		[BZ["Auchenai Crypts"]] = {
-			["loc"] = c1[BZ["Terokkar Forest"]],
-			["c"] = 3,
-		},
-		[BZ["Azjol-Nerub"]] = {
-			["loc"] = c1[BZ["Dragonblight"]],
-			["c"] = 4,
-		},
-		[BZ["Blackrock Depths"]] = {
-			["loc"] = c1[BZ["Searing Gorge"]],
-			["c"] = 2,
-		},
-		[BZ["Blackrock Spire"]] = {
-			["loc"] = c1[BZ["Searing Gorge"]],
-			["c"] = 2,
-		},
-		[BZ["Blackwing Lair"]] = {
-			["loc"] = c1[BZ["Searing Gorge"]],
-			["c"] = 2,
-		},
-		[BZ["Dire Maul"]] = {
-			["loc"] = c1[BZ["Feralas"]],
-			["c"] = 1,
-		},
-		[BZ["Drak'Tharon Keep"]] = {
-			["loc"] = c1[BZ["Zul'Drak"]],
-			["c"] = 4,
-		},
-		[BZ["Gnomeregan"]] = {
-			["loc"] = c1[BZ["Dun Morogh"]],
-			["c"] = 2,
-		},
-		[BZ["Halls of Lightning"]] = {
-			["loc"] = c1[BZ["The Storm Peaks"]],
-			["c"] = 4,
-		},
-		[BZ["Halls of Stone"]] = {
-			["loc"] = c1[BZ["The Storm Peaks"]],
-			["c"] = 4,
-		},
-		[BZ["Karazhan"]] = {
-			["loc"] = c1[BZ["Deadwind Pass"]],
-			["c"] = 2,
-		},
-		[BZ["Magisters' Terrace"]] = {
-			["loc"] = c1[BZ["Isle of Quel'Danas"]],
-			["c"] = 3,
-		},
-		[BZ["Mana-Tombs"]] = {
-			["loc"] = c1[BZ["Terokkar Forest"]],
-			["c"] = 3,
-		},
-		[BZ["The Oculus"]] = {
-			["loc"] = c1[BZ["Borean Tundra"]],
-			["c"] = 4,
-		},
-		[BZ["Old Hillsbrad Foothills"]] = {
-			["loc"] = c1[BZ["Tanaris"]],
-			["c"] = 1,
-		},
-		[BZ["Onyxia's Lair"]] = {
-			["loc"] = c1[BZ["Dustwallow Marsh"]],
-			["c"] = 1,
-		},
-		[BZ["Ruins of Ahn'Qiraj"]] = {
-			["loc"] = c1[BZ["Tanaris"]],
-			["c"] = 1,
-		},
-		[BZ["Scholomance"]] = {
-			["loc"] = c1[BZ["Western Plaguelands"]],
-			["c"] = 2,
-		},
-		[BZ["Sethekk Halls"]] = {
-			["loc"] = c1[BZ["Terokkar Forest"]],
-			["c"] = 3,
-		},
-		[BZ["Shadow Labyrinth"]] = {
-			["loc"] = c1[BZ["Terokkar Forest"]],
-			["c"] = 3,
-		},
-		[BZ["Stratholme"]] = {
-			["loc"] = c1[BZ["Eastern Plaguelands"]],
-			["c"] = 2,
-		},
-		[BZ["Temple of Ahn'Qiraj"]] = {
-			["loc"] = c1[BZ["Tanaris"]],
-			["c"] = 1,
-		},
-		[BZ["The Arcatraz"]] = {
-			["loc"] = c1[BZ["Netherstorm"]],
-			["c"] = 3,
-		},
-		[BZ["The Black Morass"]] = {
-			["loc"] = c1[BZ["Tanaris"]],
-			["c"] = 1,
-		},
-		[BZ["The Botanica"]] = {
-			["loc"] = c1[BZ["Netherstorm"]],
-			["c"] = 3,
-		},
-		[BZ["The Deadmines"]] = {
-			["loc"] = c1[BZ["Westfall"]],
-			["c"] = 2,
-		},
-		[BZ["The Mechanar"]] = {
-			["loc"] = c1[BZ["Netherstorm"]],
-			["c"] = 3,
-		},
-		[BZ["The Nexus"]] = {
-			["loc"] = c1[BZ["Borean Tundra"]],
-			["c"] = 4,
-		},
-		[BZ["The Shattered Halls"]] = {
-			["loc"] = c1[BZ["Hellfire Peninsula"]],
-			["c"] = 3,
-		},
-		[BZ["The Slave Pens"]] = {
-			["loc"] = c1[BZ["Zangarmarsh"]],
-			["c"] = 3,
-		},
-		[BZ["The Steamvault"]] = {
-			["loc"] = c1[BZ["Zangarmarsh"]],
-			["c"] = 3,
-		},
-		[BZ["The Temple of Atal'Hakkar"]] = {
-			["loc"] = c1[BZ["Swamp of Sorrows"]],
-			["c"] = 2,
-		},
-		[BZ["The Violet Hold"]] = {
-			["loc"] = c1[BZ["Dalaran"]],
-			["c"] = 4,
-		},
-		[BZ["Utgarde Keep"]] = {
-			["loc"] = c1[BZ["Howling Fjord"]],
-			["c"] = 4,
-		},
-		[BZ["Utgarde Pinnacle"]] = {
-			["loc"] = c1[BZ["Howling Fjord"]],
-			["c"] = 4,
-		},
-		[BZ["Zul'Gurub"]] = {
-			["loc"] = c1[BZ["Stranglethorn Vale"]],
-			["c"] = 2,
-		},
-	}
+			    opts.anchorFrom = from
+			    opts.anchorTo = to

-	local maplist = {}
+			    if self.is_expanded then
+				    if opts.anchorFrom == "TOPLEFT" or opts.anchorFrom == "LEFT" or opts.anchorFrom == "BOTTOMLEFT" then
+					    opts.offsetx = x
+				    elseif opts.anchorFrom == "TOP" or opts.anchorFrom == "CENTER" or opts.anchorFrom == "BOTTOM" then
+					    opts.offsetx = x - 151/2
+				    elseif opts.anchorFrom == "TOPRIGHT" or opts.anchorFrom == "RIGHT" or opts.anchorFrom == "BOTTOMRIGHT" then
+					    opts.offsetx = x - 151
+				    end
+			    else
+				    opts.offsetx = x
+			    end
+			    opts.offsety = y
+		    end)

-	-- Description: Adds mini-map and world map icons with tomtom.
-	-- Expected result: Icons are added to the world map and mini-map.
-	-- Input: An optional recipe ID
-	-- Output: Points are added to the maps
-	function addon:SetupMap(single_recipe)
-		if not TomTom then
-			return
-		end
+function MainPanel:ToggleState()
+	if self.is_expanded then
+		self:SetWidth(MAINPANEL_NORMAL_WIDTH)

-		local worldmap = addon.db.profile.worldmap
-		local minimap = addon.db.profile.minimap
+		self.backdrop:SetTexture([[Interface\Addons\AckisRecipeList\img\main]])
+		self.backdrop:SetAllPoints(self)
+		self.backdrop:SetTexCoord(0, (MAINPANEL_NORMAL_WIDTH/512), 0, (447/512))

-		if not (worldmap or minimap) then
-			return
-		end
+		self.progress_bar:SetWidth(195)
+	else
+		self:SetWidth(MAINPANEL_EXPANDED_WIDTH)

-		local icontext = "Interface\\AddOns\\AckisRecipeList\\img\\enchant_up"
+		self.backdrop:SetTexture([[Interface\Addons\AckisRecipeList\img\expanded]])
+		self.backdrop:SetAllPoints(self)
+		self.backdrop:SetTexCoord(0, (MAINPANEL_EXPANDED_WIDTH/512), 0, (447/512))

-		-- Get the proper icon to put on the mini-map
-		--		for i, k in pairs(SortedProfessions) do
-		--			if (k["name"] == Player["Profession"]) then
-		--				icontext = "Interface\\AddOns\\AckisRecipeList\\img\\" .. k["texture"] .. "_up"
-		--				break
-		--			end
-		--		end
+		self.progress_bar:SetWidth(345)
+	end
+	self.is_expanded = not self.is_expanded

-		twipe(maplist)
+	local x, y = self:GetLeft(), self:GetBottom()

-		local recipe_list = addon.recipe_list
+	self:ClearAllPoints()
+	self:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", x, y)
+	self:UpdateTitle()
+end

-		-- We're only getting a single recipe, not a bunch
-		if single_recipe then
-			-- loop through acquire methods, display each
-			for k, v in pairs(recipe_list[single_recipe]["Acquire"]) do
-				if CheckMapDisplay(v, recipe_list[single_recipe]["Flags"]) then
-					maplist[v["ID"]] = v["Type"]
-				end
-			end
-		elseif addon.db.profile.autoscanmap then
-			local sorted_recipes = addon.sorted_recipes
+function MainPanel:SetProfession()
+	for k, v in pairs(SortedProfessions) do
+		if v.name == Player["Profession"] then
+			self.profession = k
+			break
+		end
+	end
+	self.mode_button:ChangeTexture(SortedProfessions[self.profession].texture)
+end

-			-- Scan through all recipes to display, and add the vendors to a list to get their acquire info
-			for i = 1, #sorted_recipes do
-				local recipe_index = sorted_recipes[i]
+function MainPanel:SetPosition()
+	self:ClearAllPoints()

-				if recipe_list[recipe_index]["Display"] and recipe_list[recipe_index]["Search"] then
-					-- loop through acquire methods, display each
-					for k, v in pairs(recipe_list[recipe_index]["Acquire"]) do
-						if CheckMapDisplay(v, recipe_list[recipe_index]["Flags"]) then
-							maplist[v["ID"]] = v["Type"]
-						end
-					end
-				end
+	local opts = addon.db.profile.frameopts
+	local FixedOffsetX = opts.offsetx
+
+	if opts.anchorTo == "" then
+		-- no values yet, clamp to whatever frame is appropriate
+		if ATSWFrame then
+			-- Anchor frame to ATSW
+			self:SetPoint("CENTER", ATSWFrame, "CENTER", 490, 0)
+		elseif CauldronFrame then
+			-- Anchor frame to Cauldron
+			self:SetPoint("CENTER", CauldronFrame, "CENTER", 490, 0)
+		elseif Skillet then
+			-- Anchor frame to Skillet
+			self:SetPoint("CENTER", SkilletFrame, "CENTER", 468, 0)
+		else
+			-- Anchor to default tradeskill frame
+			self:SetPoint("TOPLEFT", TradeSkillFrame, "TOPRIGHT", 10, 0)
+		end
+	else
+		if self.is_expanded then
+			if opts.anchorFrom == "TOPLEFT" or opts.anchorFrom == "LEFT" or opts.anchorFrom == "BOTTOMLEFT" then
+				FixedOffsetX = opts.offsetx
+			elseif opts.anchorFrom == "TOP" or opts.anchorFrom == "CENTER" or opts.anchorFrom == "BOTTOM" then
+				FixedOffsetX = opts.offsetx + 151/2
+			elseif opts.anchorFrom == "TOPRIGHT" or opts.anchorFrom == "RIGHT" or opts.anchorFrom == "BOTTOMRIGHT" then
+				FixedOffsetX = opts.offsetx + 151
 			end
 		end
+		self:SetPoint(opts.anchorFrom, UIParent, opts.anchorTo, FixedOffsetX, opts.offsety)
+	end
+end

-		--		local ARLWorldMap = CreateFrame("Button","ARLWorldMap",WorldMapDetailFrame)
-		--		ARLWorldMap:ClearAllPoints()
-		--		ARLWorldMap:SetWidth(8)
-		--		ARLWorldMap:SetHeight(8)
-		--		ARLWorldMap.icon = ARLWorldMap:CreateTexture("ARTWORK")
-		--		ARLWorldMap.icon:SetTexture(icontext)
-		--		ARLWorldMap.icon:SetAllPoints()
-
-		--		local ARLMiniMap = CreateFrame("Button","ARLMiniMap",MiniMap)
-		--		ARLMiniMap:ClearAllPoints()
-		--		ARLMiniMap:SetWidth(8)
-		--		ARLMiniMap:SetHeight(8)
-		--		ARLMiniMap.icon = ARLMiniMap:CreateTexture("ARTWORK")
-		--		ARLMiniMap.icon:SetTexture(icontext)
-		--		ARLMiniMap.icon:SetAllPoints()
-
-		for k, j in pairs(maplist) do
-			local loc
-			local custom = false
-
-			-- Get the entries location
-			if maplist[k] == A_TRAINER then
-				loc = addon.trainer_list[k]
-			elseif maplist[k] == A_VENDOR then
-				loc = addon.vendor_list[k]
-			elseif maplist[k] == A_MOB then
-				loc = addon.mob_list[k]
-			elseif maplist[k] == A_QUEST then
-				loc = addon.quest_list[k]
-			elseif maplist[k] == A_CUSTOM then
-				loc = addon.custom_list[k]
-				custom = true
-			end
-
-			local name = loc["Name"]
-			local x = loc["Coordx"]
-			local y = loc["Coordy"]
-			local location = loc["Location"]
-			local continent, zone
-
-			if not loc then
-				--@alpha@
-				addon:Print("DEBUG: No continent/zone map match for ID " .. k .. " - loc is nil.")
-				--@end-alpha@
-			elseif c1[location] then
-				continent = 1
-				zone = c1[location]
-			elseif c2[location] then
-				continent = 2
-				zone = c2[location]
-			elseif c3[location] then
-				continent = 3
-				zone = c3[location]
-			elseif c4[location] then
-				continent = 4
-				zone = c4[location]
-			elseif INSTANCE_LOCATIONS[location] then
-				continent = INSTANCE_LOCATIONS[location]["c"]
-				zone = INSTANCE_LOCATIONS[location]["loc"]
-				name = name .. " (" .. location .. ")"
-			else
-				--@alpha@
-				addon:Print("DEBUG: No continent/zone map match for ID " .. k .. " Location: " .. location)
-				--@end-alpha@
-			end
-
-			--@alpha@
-			if (x < -100) or (x > 100) or (y < -100) or (y > 100) then
-				addon:Print("DEBUG: Invalid location coordinates for ID " .. k .. " Location: " .. location)
-			end
-			--@end-alpha@
+function MainPanel:UpdateTitle()
+	if self.is_expanded then
+		local total, active = 0, 0

-			if zone and continent then
-				--@alpha@
-				if (x == 0) and (y == 0) then
-					addon:Print("DEBUG: Location is 0,0 for ID " .. k .. " Location: " .. location)
+		for filter, info in pairs(FilterValueMap) do
+			if info.svroot then
+				if info.svroot[filter] == true then
+					active = active + 1
 				end
-				--@end-alpha@
-				local iconuid = TomTom:AddZWaypoint(continent, zone, x, y, nil, false, minimap, worldmap)
-
-				tinsert(iconlist, iconuid)
+				total = total + 1
 			end
-
 		end
+		self.title_bar:SetFormattedText(addon:Normal("ARL (v.%s) - %s (%d/%d %s)"), addon.version, Player["Profession"], active, total, _G.FILTERS)
+	else
+		self.title_bar:SetFormattedText(addon:Normal("ARL (v.%s) - %s"), addon.version, Player["Profession"])
 	end
-end -- do block
-
--- Description: Converting from hex to rgb (Thanks Maldivia)
-local function toRGB(hex)
-	local r, g, b = hex:match("(..)(..)(..)")
-
-	return (tonumber(r, 16) / 256), (tonumber(g,16) / 256), (tonumber(b, 16) / 256)
 end

 -------------------------------------------------------------------------------
--- Tooltip functions and data.
+-- Create the MainPanel.mode_button and assign its values.
 -------------------------------------------------------------------------------
-local arlTooltip
-
--- Font Objects needed for arlTooltip
-local narrowFont
-local normalFont
+MainPanel.mode_button = CreateFrame("Button", nil, MainPanel, "UIPanelButtonTemplate")
+MainPanel.mode_button:SetWidth(64)
+MainPanel.mode_button:SetHeight(64)
+MainPanel.mode_button:SetPoint("TOPLEFT", MainPanel, "TOPLEFT", 1, -2)
+MainPanel.mode_button:RegisterForClicks("LeftButtonUp", "RightButtonUp")

-local narrowFontObj = CreateFont(MODNAME.."narrowFontObj")
-local normalFontObj = CreateFont(MODNAME.."normalFontObj")
+MainPanel.mode_button._normal = MainPanel.mode_button:CreateTexture(nil, "BACKGROUND")
+MainPanel.mode_button._pushed = MainPanel.mode_button:CreateTexture(nil, "BACKGROUND")
+MainPanel.mode_button._disabled = MainPanel.mode_button:CreateTexture(nil, "BACKGROUND")

--- Fallback in case the user doesn't have LSM-3.0 installed
-if not LibStub:GetLibrary("LibSharedMedia-3.0", true) then
+-------------------------------------------------------------------------------
+-- MainPanel.mode_button scripts/functions.
+-------------------------------------------------------------------------------
+MainPanel.mode_button:SetScript("OnClick",
+				function(self, button, down)
+					-- Known professions should be in Player["Professions"]

-	local locale = GetLocale()
-	-- Fix for font issues on koKR
-	if locale == "koKR" then
-		narrowFont = "Fonts\\2002.TTF"
-		normalFont = "Fonts\\2002.TTF"
-	else
-		narrowFont = "Fonts\\ARIALN.TTF"
-		normalFont = "Fonts\\FRIZQT__.TTF"
-	end
-else
-	-- Register LSM 3.0
-	local LSM3 = LibStub("LibSharedMedia-3.0")
+					-- This loop is gonna be weird. The reason is because we need to
+					-- ensure that we cycle through all the known professions, but also
+					-- that we do so in order. That means that if the currently displayed
+					-- profession is the last one in the list, we're actually going to
+					-- iterate completely once to get to the currently displayed profession
+					-- and then iterate again to make sure we display the next one in line.
+					-- Further, there is the nuance that the person may not know any
+					-- professions yet at all. User are so annoying.
+					local startLoop = 0
+					local endLoop = 0
+					local displayProf = 0

-	narrowFont = LSM3:Fetch(LSM3.MediaType.FONT, "Arial Narrow")
-	normalFont = LSM3:Fetch(LSM3.MediaType.FONT, "Friz Quadrata TT")
-end
+					-- ok, so first off, if we've never done this before, there is no "current"
+					-- and a single iteration will do nicely, thank you
+					if button == "LeftButton" then
+						-- normal profession switch
+						if MainPanel.profession == 0 then
+							startLoop = 1
+							endLoop = NUM_PROFESSIONS + 1
+						else
+							startLoop = MainPanel.profession + 1
+							endLoop = MainPanel.profession
+						end
+						local index = startLoop
+
+						while index ~= endLoop do
+							if index > NUM_PROFESSIONS then
+								index = 1
+							elseif Player["Professions"][SortedProfessions[index].name] then
+								displayProf = index
+								MainPanel.profession = index
+								break
+							else
+								index = index + 1
+							end
+						end
+					elseif button == "RightButton" then
+						-- reverse profession switch
+						if MainPanel.profession == 0 then
+							startLoop = NUM_PROFESSIONS + 1
+							endLoop = 0
+						else
+							startLoop = MainPanel.profession - 1
+							endLoop = MainPanel.profession
+						end
+						local index = startLoop

--- I want to do a bit more comprehensive tooltip processing. Things like changing font sizes,
--- adding padding to the left hand side, and using better color handling. So... this function
--- will do that for me.
-local function ttAdd(
-	leftPad,		-- number of times to pad two spaces on left side
-	textSize,		-- add to or subtract from addon.db.profile.frameopts.fontsize to get fontsize
-	narrow,			-- if 1, use ARIALN instead of FRITZQ
-	str1,			-- left-hand string
-	hexcolor1,		-- hex color code for left-hand side
-	str2,			-- if present, this is the right-hand string
-	hexcolor2)		-- if present, hex color code for right-hand side
+						while index ~= endLoop do
+							if index < 1 then
+								index = NUM_PROFESSIONS
+							elseif Player["Professions"][SortedProfessions[index].name] then
+								displayProf = index
+								MainPanel.profession = index
+								break
+							else
+								index = index - 1
+							end
+						end
+					end
+					local is_shown = TradeSkillFrame:IsVisible()

-	-- are we changing fontsize or narrow?
-	local fontSize
-	if ((narrow == 1) or (textSize ~= 0)) then
-		local font, fontObj = normalFont, normalFontObj
-		if (narrow == 1) then
-			font = narrowFont
-			fontObj = narrowFontObj
-		end
+					CastSpellByName(SortedProfessions[MainPanel.profession].name)
+					addon:Scan()

-		fontSize = addon.db.profile.frameopts.fontsize + textSize
+					if not is_shown then
+						TradeSkillFrame:Hide()
+					end
+				end)

-		fontObj:SetFont(font, fontSize)
-		arlTooltip:SetFont(fontObj)
-	end
+function MainPanel.mode_button:ChangeTexture(texture)
+	local normal, pushed, disabled = self._normal, self._pushed, self._disabled

-	-- Add in our left hand padding
-	local loopPad = leftPad
-	local leftStr = str1
+	normal:SetTexture([[Interface\Addons\AckisRecipeList\img\]] .. texture .. [[_up]])
+	normal:SetTexCoord(0, 1, 0, 1)
+	normal:SetAllPoints(self)
+	self:SetNormalTexture(normal)

-	while (loopPad > 0) do
-		leftStr = "  " .. leftStr
-		loopPad = loopPad - 1
-	end
-	local lineNum
+	pushed:SetTexture([[Interface\Addons\AckisRecipeList\img\]] .. texture .. [[_down]])
+	pushed:SetTexCoord(0, 1, 0, 1)
+	pushed:SetAllPoints(self)
+	self:SetPushedTexture(pushed)

-	if (str2) then
-		lineNum = arlTooltip:AddLine()
-		arlTooltip:SetCell(lineNum, 1, "|cff"..hexcolor1..leftStr.."|r")
-		arlTooltip:SetCell(lineNum, 2, "|cff"..hexcolor2..str2.."|r", "RIGHT")
-	else
-		-- Text spans both columns - set maximum width to match fontSize to maintain uniform tooltip size. -Torhal
-		local width = math.ceil(fontSize * 37.5)
-		lineNum = arlTooltip:AddLine()
-		arlTooltip:SetCell(lineNum, 1, "|cff"..hexcolor1..leftStr.."|r", nil, "LEFT", 2, nil, 0, 0, width, width)
-	end
+	disabled:SetTexture([[Interface\Addons\AckisRecipeList\img\]] .. texture .. [[_up]])
+	disabled:SetTexCoord(0, 1, 0, 1)
+	disabled:SetAllPoints(self)
+	self:SetDisabledTexture(disabled)
 end

-local function SetSpellTooltip(owner, loc, link)
-	arlSpellTooltip:SetOwner(owner, "ANCHOR_NONE")
-	arlSpellTooltip:ClearAllPoints()
+-------------------------------------------------------------------------------
+-- Create the X-close button, and set its scripts.
+-------------------------------------------------------------------------------
+MainPanel.xclose_button = CreateFrame("Button", nil, MainPanel, "UIPanelCloseButton")
+MainPanel.xclose_button:SetPoint("TOPRIGHT", MainPanel, "TOPRIGHT", 5, -6)

-	if loc == "Top" then
-		arlSpellTooltip:SetPoint("BOTTOMLEFT", owner, "TOPLEFT")
-	elseif loc == "Bottom" then
-		arlSpellTooltip:SetPoint("TOPLEFT", owner, "BOTTOMLEFT")
-	elseif loc == "Left" then
-		arlSpellTooltip:SetPoint("TOPRIGHT", owner, "TOPLEFT")
-	elseif loc == "Right" then
-		arlSpellTooltip:SetPoint("TOPLEFT", owner, "TOPRIGHT")
-	end
+MainPanel.xclose_button:SetScript("OnClick",
+				  function(self, button, down)
+					  MainPanel:Hide()
+				  end)

-	-- Add TipTac Support
-	if TipTac and TipTac.AddModifiedTip and not arlSpellTooltip.tiptac then
-		TipTac:AddModifiedTip(arlSpellTooltip)
-		arlSpellTooltip.tiptac = true
-	end
+-------------------------------------------------------------------------------
+-- Create MainPanel.filter_toggle, and set its scripts.
+-------------------------------------------------------------------------------
+MainPanel.filter_toggle = GenericCreateButton(nil, MainPanel, 25, 90, "GameFontNormalSmall", "GameFontHighlightSmall", L["FILTER_OPEN"], "CENTER", L["FILTER_OPEN_DESC"], 1)
+MainPanel.filter_toggle:SetPoint("TOPRIGHT", MainPanel, "TOPRIGHT", -8, -40)

-	-- Set the spell tooltip's scale, and copy its other values from GameTooltip so AddOns which modify it will work.
-	arlSpellTooltip:SetBackdrop(GameTooltip:GetBackdrop())
-	arlSpellTooltip:SetBackdropColor(GameTooltip:GetBackdropColor())
-	arlSpellTooltip:SetBackdropBorderColor(GameTooltip:GetBackdropBorderColor())
-	arlSpellTooltip:SetScale(addon.db.profile.frameopts.tooltipscale)
+MainPanel.filter_toggle:SetScript("OnClick",
+			   function(self, button, down)
+				   if MainPanel.is_expanded then
+					   -- Change the text and tooltip for the filter button
+					   self:SetText(L["FILTER_OPEN"])
+					   SetTooltipScripts(self, L["FILTER_OPEN_DESC"])

-	arlSpellTooltip:SetHyperlink(link)
-	arlSpellTooltip:Show()
-end
+					   -- Hide my 7 buttons
+					   ARL_ExpGeneralOptCB:Hide()
+					   ARL_ExpObtainOptCB:Hide()
+					   ARL_ExpBindingOptCB:Hide()
+					   ARL_ExpItemOptCB:Hide()
+					   ARL_ExpPlayerOptCB:Hide()
+					   ARL_ExpRepOptCB:Hide()
+					   ARL_ExpMiscOptCB:Hide()

-local function GenerateTooltipContent(owner, rIndex)
-	local spellTooltipLocation = addon.db.profile.spelltooltiplocation
-	local acquireTooltipLocation = addon.db.profile.acquiretooltiplocation
-	local recipe_entry = addon.recipe_list[rIndex]
-	local spellLink = recipe_entry["RecipeLink"]
+					   -- Uncheck the seven buttons
+					   HideARL_ExpOptCB()

-	if acquireTooltipLocation == _G.OFF then
-		QTip:Release(arlTooltip)
+					   MainPanel.filter_menu:Hide()
+					   MainPanel.filter_reset:Hide()
+				   else
+					   -- Change the text and tooltip for the filter button
+					   self:SetText(L["FILTER_CLOSE"])
+					   SetTooltipScripts(self, L["FILTER_CLOSE_DESC"])

-		-- If we have the spell link tooltip, anchor it to MainPanel instead so it shows
-		if spellTooltipLocation ~= _G.OFF and spellLink then
-			SetSpellTooltip(MainPanel, spellTooltipLocation, spellLink)
-		else
-			arlSpellTooltip:Hide()
-		end
-		return
-	end
-	arlTooltip = QTip:Acquire(MODNAME.." Tooltip", 2, "LEFT", "LEFT")
-	arlTooltip:ClearAllPoints()
+					   -- Show my 7 buttons
+					   ARL_ExpGeneralOptCB:Show()
+					   ARL_ExpObtainOptCB:Show()
+					   ARL_ExpBindingOptCB:Show()
+					   ARL_ExpItemOptCB:Show()
+					   ARL_ExpPlayerOptCB:Show()
+					   ARL_ExpRepOptCB:Show()
+					   ARL_ExpMiscOptCB:Show()

-	if acquireTooltipLocation == "Right" then
-		arlTooltip:SetPoint("TOPLEFT", MainPanel, "TOPRIGHT")
-	elseif acquireTooltipLocation == "Left" then
-		arlTooltip:SetPoint("TOPRIGHT", MainPanel, "TOPLEFT")
-	elseif acquireTooltipLocation == "Top" then
-		arlTooltip:SetPoint("BOTTOMLEFT", MainPanel, "TOPLEFT")
-	elseif acquireTooltipLocation == "Bottom" then
-		arlTooltip:SetPoint("TOPLEFT", MainPanel, "BOTTOMLEFT")
-	elseif acquireTooltipLocation == "Mouse" then
-		local x, y = GetCursorPosition()
-		local uiscale = UIParent:GetEffectiveScale()
+					   MainPanel.filter_reset:Show()
+				   end
+				   MainPanel:ToggleState()
+			   end)

-		arlTooltip:ClearAllPoints()
-		arlTooltip:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", x / uiscale, y / uiscale)
-	end
+-------------------------------------------------------------------------------
+-- Create MainPanel.filter_menu and set its scripts.
+-------------------------------------------------------------------------------
+MainPanel.filter_menu = CreateFrame("Frame", "ARL_FilterMenu", MainPanel)
+MainPanel.filter_menu:SetWidth(FILTERMENU_DOUBLE_WIDTH)
+MainPanel.filter_menu:SetHeight(FILTERMENU_HEIGHT)
+MainPanel.filter_menu:SetPoint("TOPLEFT", MainPanel, "TOPRIGHT", -6, -102)
+MainPanel.filter_menu:EnableMouse(true)
+MainPanel.filter_menu:EnableKeyboard(true)
+MainPanel.filter_menu:SetMovable(false)
+MainPanel.filter_menu:SetHitRectInsets(5, 5, 5, 5)
+MainPanel.filter_menu:Hide()

-	if TipTac and TipTac.AddModifiedTip then
-		-- Pass true as second parameter because hooking OnHide causes C stack overflows -Torhal
-		TipTac:AddModifiedTip(arlTooltip, true)
-	end
-	local clr1, clr2 = "", ""
+-- Set all the current options in the filter menu to make sure they are consistent with the SV options.
+MainPanel.filter_menu:SetScript("OnShow",
+				function()
+					for filter, info in pairs(FilterValueMap) do
+						if info.svroot then
+							info.cb:SetChecked(info.svroot[filter])
+						end
+					end
+					-- Miscellaneous Options
+					ARL_IgnoreCB:SetChecked(addon.db.profile.ignoreexclusionlist)
+				end)

-	arlTooltip:Clear()
-	arlTooltip:SetScale(addon.db.profile.frameopts.tooltipscale)
-	arlTooltip:AddHeader()
-	arlTooltip:SetCell(1, 1, "|cff"..addon:hexcolor("HIGH")..recipe_entry["Name"], "CENTER", 2)
+MainPanel.filter_menu.texture = MainPanel.filter_menu:CreateTexture(nil, "ARTWORK")
+MainPanel.filter_menu.texture:SetTexture("Interface\\Addons\\AckisRecipeList\\img\\fly_2col")
+MainPanel.filter_menu.texture:SetAllPoints(MainPanel.filter_menu)
+MainPanel.filter_menu.texture:SetTexCoord(0, (FILTERMENU_DOUBLE_WIDTH/256), 0, (FILTERMENU_HEIGHT/512))

-	-- check if the recipe is excluded
-	local exclude = addon.db.profile.exclusionlist
+-------------------------------------------------------------------------------
+-- Create MainPanel.filter_reset and set its scripts.
+-------------------------------------------------------------------------------
+MainPanel.filter_reset = GenericCreateButton(nil, MainPanel, 25, 90, "GameFontNormalSmall", "GameFontHighlightSmall", _G.RESET, "CENTER",
+					     L["RESET_DESC"], 1)
+MainPanel.filter_reset:SetPoint("TOPRIGHT", MainPanel.filter_toggle, "BOTTOMRIGHT", 0, -2)
+MainPanel.filter_reset:Hide()

-	if exclude[rIndex] then
-		ttAdd(0, -1, 1, L["RECIPE_EXCLUDED"], addon:hexcolor("RED"))
+do
+	local function recursiveReset(t)
+		-- Thanks to Antiarc for this code
+		for k, v in pairs(t) do
+			if type(v) == "table" then
+				recursiveReset(v)
+			else
+				t[k] = true
+			end
+		end
 	end

-	-- Add in skill level requirement, colored correctly
-	clr1 = addon:hexcolor("NORMAL")
+	MainPanel.filter_reset:SetScript("OnClick",
+					 function()
+						 local filterdb = addon.db.profile.filters

-	local recipeSkill = recipe_entry["Level"]
-	local playerSkill = Player["ProfessionLevel"]
+						 -- Reset all filters to true
+						 recursiveReset(addon.db.profile.filters)

-	if recipeSkill > playerSkill then
-		clr2 = addon:hexcolor("RED")
-	elseif playerSkill - recipeSkill < 20 then
-		clr2 = addon:hexcolor("ORANGE")
-	elseif playerSkill - recipeSkill < 30 then
-		clr2 = addon:hexcolor("YELLOW")
-	elseif playerSkill - recipeSkill < 40 then
-		clr2 = addon:hexcolor("GREEN")
-	else
-		clr2 = addon:hexcolor("MIDGREY")
-	end
-	ttAdd(0, -1, 0, L["Required Skill"] .. " :", clr1, recipe_entry["Level"], clr2)
-	arlTooltip:AddSeparator()
-	-- Binding info
-	clr1 = addon:hexcolor("NORMAL")
+						 -- Reset specific filters to false
+						 filterdb.general.specialty = false
+						 filterdb.general.known = false

-	if (recipe_entry["Flags"][36]) then
-		ttAdd(0, -1, 1, L["BOEFilter"], clr1)
-	end
+						 -- Reset all classes to false
+						 for class in pairs(filterdb.classes) do
+							 filterdb.classes[class] = false
+						 end
+						 -- Set your own class to true
+						 filterdb.classes[strlower(Player["Class"])] = true

-	if (recipe_entry["Flags"][37]) then
-		ttAdd(0, -1, 1, L["BOPFilter"], clr1)
-	end
+						 if MainPanel:IsVisible() then
+							 MainPanel:UpdateTitle()
+							 HideARL_ExpOptCB()
+							 MainPanel.filter_menu:Hide()
+							 ReDisplay()
+						 end
+					 end)
+end	-- do

-	if (recipe_entry["Flags"][38]) then
-		ttAdd(0, -1, 1, L["BOAFilter"], clr1)
+-------------------------------------------------------------------------------
+-- Create MainPanel.scrollframe and set its scripts.
+-------------------------------------------------------------------------------
+MainPanel.scroll_frame = CreateFrame("ScrollFrame", "ARL_MainPanelScrollFrame", MainPanel, "FauxScrollFrameTemplate")
+MainPanel.scroll_frame:SetHeight(322)
+MainPanel.scroll_frame:SetWidth(243)
+MainPanel.scroll_frame:SetPoint("TOPLEFT", MainPanel, "TOPLEFT", 20, -97)
+MainPanel.scroll_frame:SetScript("OnVerticalScroll",
+				 function(self, arg1)
+					 self.scrolling = true
+					 FauxScrollFrame_OnVerticalScroll(self, arg1, 16, self.Update)
+					 self.scrolling = nil
+				 end)
+
+MainPanel.scroll_frame.entries = {}
+MainPanel.scroll_frame.state_buttons = {}
+MainPanel.scroll_frame.recipe_buttons = {}
+
+do
+	local highlight = CreateFrame("Frame", nil, UIParent)
+	highlight:SetFrameStrata("TOOLTIP")
+	highlight:Hide()
+
+	highlight._texture = highlight:CreateTexture(nil, "OVERLAY")
+	highlight._texture:SetTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight")
+	highlight._texture:SetBlendMode("ADD")
+	highlight._texture:SetAllPoints(highlight)
+
+	local function Button_OnEnter(self)
+		GenerateTooltipContent(self, MainPanel.scroll_frame.entries[self.string_index].recipe_id)
 	end

-	if (recipe_entry["Flags"][40]) then
-		ttAdd(0, -1, 1, L["RecipeBOEFilter"], clr1)
+	local function Button_OnLeave()
+		QTip:Release(arlTooltip)
+		arlSpellTooltip:Hide()
 	end

-	if (recipe_entry["Flags"][41]) then
-		ttAdd(0, -1, 1, L["RecipeBOPFilter"], clr1)
+	local function Bar_OnEnter(self)
+		highlight:SetParent(self)
+		highlight:SetAllPoints(self)
+		highlight:Show()
+		GenerateTooltipContent(self, MainPanel.scroll_frame.entries[self.string_index].recipe_id)
 	end

-	if (recipe_entry["Flags"][42]) then
-		ttAdd(0, -1, 1, L["RecipeBOAFilter"], clr1)
+	local function Bar_OnLeave()
+		highlight:Hide()
+		highlight:ClearAllPoints()
+		highlight:SetParent(nil)
+		QTip:Release(arlTooltip)
+		arlSpellTooltip:Hide()
 	end
-	arlTooltip:AddSeparator()

-	-- obtain info
-	ttAdd(0, -1, 0, L["Obtained From"] .. " : ", addon:hexcolor("NORMAL"))
+	function MainPanel.scroll_frame:Update(expand_acquires, refresh)
+		local sorted_recipes = addon.sorted_recipes
+		local recipe_list = addon.recipe_list
+		local exclusions = addon.db.profile.exclusionlist
+		local sort_type = addon.db.profile.sorting
+		local skill_sort = (sort_type == "SkillAsc" or sort_type == "SkillDesc")
+		local insert_index = 1

-	local playerFaction = Player["Faction"]
-	local rep_list = addon.reputation_list
+		-- If not refreshing an existing list and not scrolling up/down, wipe and re-initialize the entries.
+		if not refresh and not self.scrolling then
+			for i = 1, #self.entries do
+				ReleaseTable(self.entries[i])
+			end
+			twipe(self.entries)

-	-- loop through acquire methods, display each
-	for k, v in pairs(recipe_entry["Acquire"]) do
-		local acquire_type = v["Type"]
+			for i = 1, #sorted_recipes do
+				local recipe_index = sorted_recipes[i]
+				local recipe_entry = recipe_list[recipe_index]

-		if acquire_type == A_TRAINER then
-			-- Trainer:			TrainerName
-			-- TrainerZone			TrainerCoords
-			local trnr = addon.trainer_list[v["ID"]]
-			local cStr = ""
+				if recipe_entry["Display"] and recipe_entry["Search"] then
+					local recipe_string = recipe_entry["Name"]

-			clr1 = addon:hexcolor("TRAINER")
-			-- Don't display trainers if it's opposite faction
-			local displaytt = false
+					if exclusions[recipe_index] then
+						recipe_string = "** " .. recipe_string .. " **"
+					end
+					local recipe_level = recipe_entry["Level"]

-			if (trnr["Faction"] == FACTION_HORDE) then
-				clr2 = addon:hexcolor("HORDE")
+					recipe_string = skill_sort and ("[" .. recipe_level .. "] - " .. recipe_string) or (recipe_string .. " - [" .. recipe_level .. "]")

-				if (playerFaction == FACTION_HORDE) then
-					displaytt = true
-				end
-			elseif (trnr["Faction"] == FACTION_ALLIANCE) then
-				clr2 = addon:hexcolor("ALLIANCE")
+					local t = AcquireTable()
+					t.text = ColourSkillLevel(recipe_entry, Player:HasProperRepLevel(recipe_index), recipe_string)

-				if (playerFaction == FACTION_ALLIANCE) then
-					displaytt = true
-				end
-			else
-				clr2 = addon:hexcolor("NEUTRAL")
-				displaytt = true
-			end
+					t.recipe_id = recipe_index
+					t.is_header = true

-			if (displaytt) then
-				-- Add the trainer information to the tooltip
-				ttAdd(0, -2, 0, L["Trainer"], clr1, trnr["Name"], clr2)
-				-- If we have a coordinate, add the coordinates to the tooltop
-				if (trnr["Coordx"] ~= 0) and (trnr["Coordy"] ~= 0) then
-					cStr = "(" .. trnr["Coordx"] .. ", " .. trnr["Coordy"] .. ")"
+					if expand_acquires and recipe_entry["Acquire"] then
+						-- we have acquire information for this. push the title entry into the strings
+						-- and start processing the acquires
+						t.is_expanded = true
+						tinsert(self.entries, insert_index, t)
+						insert_index = self:ExpandEntry(insert_index)
+					else
+						t.is_expanded = false
+						tinsert(self.entries, insert_index, t)
+						insert_index = insert_index + 1
+					end
 				end
-				clr1 = addon:hexcolor("NORMAL")
-				clr2 = addon:hexcolor("HIGH")
-				ttAdd(1, -2, 1, trnr["Location"], clr1, cStr, clr2)
 			end
-		elseif acquire_type == A_VENDOR then
-			-- Vendor:					VendorName
-			-- VendorZone				VendorCoords
-			local vendor = addon.vendor_list[v["ID"]]
-			local cStr = ""
+		end

-			clr1 = addon:hexcolor("VENDOR")
-			-- Don't display vendors of opposite faction
-			local displaytt = false
-			local faction
+		-- Reset the current buttons/lines
+		for i = 1, NUM_RECIPE_LINES do
+			local recipe = self.recipe_buttons[i]
+			local state = self.state_buttons[i]

-			if (vendor["Faction"] == FACTION_HORDE) then
-				clr2 = addon:hexcolor("HORDE")
-				if (playerFaction == FACTION_HORDE) then
-					displaytt = true
-				else
-					faction = FACTION_HORDE
-				end
-			elseif (vendor["Faction"] == FACTION_ALLIANCE) then
-				clr2 = addon:hexcolor("ALLIANCE")
-				if (playerFaction == FACTION_ALLIANCE) then
-					displaytt = true
-				else
-					faction = FACTION_ALLIANCE
-				end
-			else
-				clr2 = addon:hexcolor("NEUTRAL")
-				displaytt = true
-			end
+			recipe.string_index = 0
+			recipe:SetText("")
+			recipe:SetScript("OnEnter", nil)
+			recipe:SetScript("OnLeave", nil)

-			if displaytt then
-				if (vendor["Coordx"] ~= 0) and (vendor["Coordy"] ~= 0) then
-					cStr = "(" .. vendor["Coordx"] .. ", " .. vendor["Coordy"] .. ")"
-				end
+			state.string_index = 0
+			state:Hide()
+			state:SetScript("OnEnter", nil)
+			state:SetScript("OnLeave", nil)
+		end
+		local num_entries = #self.entries
+		local display_lines = NUM_RECIPE_LINES

-				ttAdd(0, -1, 0, L["Vendor"], clr1, vendor["Name"], clr2)
-				clr1 = addon:hexcolor("NORMAL")
-				clr2 = addon:hexcolor("HIGH")
-				ttAdd(1, -2, 1, vendor["Location"], clr1, cStr, clr2)
-			elseif faction then
-				ttAdd(0, -1, 0, faction.." "..L["Vendor"], clr1)
-			end
-		elseif acquire_type == A_MOB then
-			-- Mob Drop:			Mob Name
-			-- MoBZ				MobCoords
-			local mob = addon.mob_list[v["ID"]]
-			local cStr = ""
+		if num_entries < display_lines then
+			display_lines = num_entries / 2
+		end
+		FauxScrollFrame_Update(self, num_entries, display_lines, 16)
+		addon:ClosePopups()

-			if (mob["Coordx"] ~= 0) and (mob["Coordy"] ~= 0) then
-				cStr = "(" .. mob["Coordx"] .. ", " .. mob["Coordy"] .. ")"
-			end
+		if num_entries > 0 then
+			ARL_ExpandButton:SetNormalFontObject("GameFontNormalSmall")
+			ARL_ExpandButton:Enable()

-			clr1 = addon:hexcolor("MOBDROP")
-			clr2 = addon:hexcolor("HORDE")
-			ttAdd(0, -1, 0, L["Mob Drop"], clr1, mob["Name"], clr2)
-			clr1 = addon:hexcolor("NORMAL")
-			clr2 = addon:hexcolor("HIGH")
-			ttAdd(1, -2, 1, mob["Location"], clr1, cStr, clr2)
-		elseif acquire_type == A_QUEST then
-			-- Quest:				QuestName
-			-- QuestZone				QuestCoords
-			local quest = addon.quest_list[v["ID"]]
+			-- Populate the buttons with new values
+			local button_index = 1
+			local string_index = button_index + FauxScrollFrame_GetOffset(self)
+			local stayInLoop = true

-			if quest then
-				clr1 = addon:hexcolor("QUEST")
-				-- Don't display quests of opposite faction
-				local displaytt = false
-				local faction
+			while stayInLoop do
+				local cur_state = self.state_buttons[button_index]
+				local cur_entry = self.entries[string_index]

-				if (quest["Faction"] == FACTION_HORDE) then
-					clr2 = addon:hexcolor("HORDE")
-					if (playerFaction == FACTION_HORDE) then
-						displaytt = true
-					else
-						faction = FACTION_HORDE
-					end
-				elseif (quest["Faction"] == FACTION_ALLIANCE) then
-					clr2 = addon:hexcolor("ALLIANCE")
-					if (playerFaction == FACTION_ALLIANCE) then
-						displaytt = true
+				if cur_entry.is_header then
+					cur_state:Show()
+
+					if cur_entry.is_expanded then
+						cur_state:SetNormalTexture("Interface\\Buttons\\UI-MinusButton-Up")
+						cur_state:SetPushedTexture("Interface\\Buttons\\UI-MinusButton-Down")
+						cur_state:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight")
+						cur_state:SetDisabledTexture("Interface\\Buttons\\UI-MinusButton-Disabled")
 					else
-						faction = FACTION_ALLIANCE
+						cur_state:SetNormalTexture("Interface\\Buttons\\UI-PlusButton-Up")
+						cur_state:SetPushedTexture("Interface\\Buttons\\UI-PlusButton-Down")
+						cur_state:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight")
+						cur_state:SetDisabledTexture("Interface\\Buttons\\UI-PlusButton-Disabled")
 					end
+					cur_state.string_index = string_index
+					cur_state:SetScript("OnEnter", Button_OnEnter)
+					cur_state:SetScript("OnLeave", Button_OnLeave)
 				else
-					clr2 = addon:hexcolor("NEUTRAL")
-					displaytt = true
+					cur_state:Hide()
 				end
+				local cur_recipe = self.recipe_buttons[button_index]

-				if displaytt then
-					local cStr = ""
+				cur_recipe.string_index = string_index
+				cur_recipe:SetText(cur_entry.text)
+				cur_recipe:SetScript("OnEnter", Bar_OnEnter)
+				cur_recipe:SetScript("OnLeave", Bar_OnLeave)

-					if (quest["Coordx"] ~= 0) and (quest["Coordy"] ~= 0) then
-						cStr = "(" .. quest["Coordx"] .. ", " .. quest["Coordy"] .. ")"
-					end
+				button_index = button_index + 1
+				string_index = string_index + 1

-					ttAdd(0, -1, 0, L["Quest"], clr1, quest["Name"], clr2)
-					clr1 = addon:hexcolor("NORMAL")
-					clr2 = addon:hexcolor("HIGH")
-					ttAdd(1, -2, 1, quest["Location"], clr1, cStr, clr2)
-				elseif faction then
-					ttAdd(0, -1, 0, faction.." "..L["Quest"], clr1)
+				if (button_index > NUM_RECIPE_LINES) or (string_index > num_entries) then
+					stayInLoop = false
 				end
 			end
-		elseif acquire_type == A_SEASONAL then
-			-- Seasonal:				SeasonEventName
-			clr1 = addon:hexcolor("SEASON")
-			ttAdd(0, -1, 0, SEASONAL_CATEGORY, clr1, addon.seasonal_list[v["ID"]]["Name"], clr1)
-		elseif acquire_type == A_REPUTATION then
-			-- Reputation:				Faction
-			-- RepLevel				RepVendor
-			-- RepVendorZone			RepVendorCoords
+		else
+			-- disable expand button, it's useless here and would spam the same error again
+			ARL_ExpandButton:SetNormalFontObject("GameFontDisableSmall")
+			ARL_ExpandButton:Disable()

-			local repfac = rep_list[v["ID"]]
-			local repname = repfac["Name"] -- name
-			local rplvl = v["RepLevel"]
-			local repvendor = addon.vendor_list[v["RepVendor"]]
-			local cStr = ""
+			local showpopup = false

-			if (repvendor["Coordx"] ~= 0) and (repvendor["Coordy"] ~= 0) then
-				cStr = "(" .. repvendor["Coordx"] .. ", " .. repvendor["Coordy"] .. ")"
+			if not addon.db.profile.hidepopup then
+				showpopup = true
 			end
-			clr1 = addon:hexcolor("REP")
-			clr2 = addon:hexcolor("NORMAL")
-			ttAdd(0, -1, 0, _G.REPUTATION, clr1, repname, clr2)

-			local rStr = ""
-			if (rplvl == 0) then
-				rStr = FACTION_NEUTRAL
-				clr1 = addon:hexcolor("NEUTRAL")
-			elseif (rplvl == 1) then
-				rStr = BFAC["Friendly"]
-				clr1 = addon:hexcolor("FRIENDLY")
-			elseif (rplvl == 2) then
-				rStr = BFAC["Honored"]
-				clr1 = addon:hexcolor("HONORED")
-			elseif (rplvl == 3) then
-				rStr = BFAC["Revered"]
-				clr1 = addon:hexcolor("REVERED")
-			else
-				rStr = BFAC["Exalted"]
-				clr1 = addon:hexcolor("EXALTED")
+			-- If we haven't run this before we'll show pop-ups for the first time.
+			if addon.db.profile.addonversion ~= addon.version then
+				addon.db.profile.addonversion = addon.version
+				showpopup = true
 			end

-			local displaytt = false
-			if repvendor["Faction"] == FACTION_HORDE then
-				clr2 = addon:hexcolor("HORDE")
-
-				if playerFaction == FACTION_HORDE then
-					displaytt = true
+			if Player.recipes_total == 0 then
+				if showpopup then
+					StaticPopup_Show("ARL_NOTSCANNED")
 				end
-			elseif repvendor["Faction"] == FACTION_ALLIANCE then
-				clr2 = addon:hexcolor("ALLIANCE")
-
-				if playerFaction == FACTION_ALLIANCE then
-					displaytt = true
+			elseif Player.recipes_known == Player.recipes_total then
+				if showpopup then
+					StaticPopup_Show("ARL_ALLKNOWN")
 				end
-			else
-				clr2 = addon:hexcolor("NEUTRAL")
-				displaytt = true
-			end
-
-			if displaytt then
-				ttAdd(1, -2, 0, rStr, clr1, repvendor["Name"], clr2)
-				clr1 = addon:hexcolor("NORMAL")
-				clr2 = addon:hexcolor("HIGH")
-				ttAdd(2, -2, 1, repvendor["Location"], clr1, cStr, clr2)
-			end
-		elseif acquire_type == A_WORLD_DROP then
-			-- World Drop				RarityLevel
-			if (v["ID"] == 1) then
-				clr1 = addon:hexcolor("COMMON")
-			elseif (v["ID"] == 2) then
-				clr1 = addon:hexcolor("UNCOMMON")
-			elseif (v["ID"] == 3) then
-				clr1 = addon:hexcolor("RARE")
-			elseif (v["ID"] == 4) then
-				clr1 = addon:hexcolor("EPIC")
-			else
-				clr1 = addon:hexcolor("NORMAL")
-			end
-			ttAdd(0, -1, 0, L["World Drop"], clr1)
-		elseif acquire_type == A_CUSTOM then
-			local customname = addon.custom_list[v["ID"]]["Name"]
-
-			ttAdd(0, -1, 0, customname, addon:hexcolor("NORMAL"))
-		elseif acquire_type == A_PVP then
-			-- Vendor:					VendorName
-			-- VendorZone				VendorCoords
-			local vendor = addon.vendor_list[v["ID"]]
-			local cStr = ""
-
-			clr1 = addon:hexcolor("VENDOR")
-			-- Don't display vendors of opposite faction
-			local displaytt = false
-			local faction
-
-			if (vendor["Faction"] == FACTION_HORDE) then
-				clr2 = addon:hexcolor("HORDE")
-				if (playerFaction == FACTION_HORDE) then
-					displaytt = true
-				else
-					faction = FACTION_HORDE
+			elseif (Player.recipes_total_filtered - Player.recipes_known_filtered) == 0 then
+				if showpopup then
+					StaticPopup_Show("ARL_ALLFILTERED")
 				end
-			elseif (vendor["Faction"] == FACTION_ALLIANCE) then
-				clr2 = addon:hexcolor("ALLIANCE")
-				if (playerFaction == FACTION_ALLIANCE) then
-					displaytt = true
-				else
-					faction = FACTION_ALLIANCE
+			elseif Player.excluded_recipes_unknown ~= 0 then
+				if showpopup then
+					StaticPopup_Show("ARL_ALLEXCLUDED")
 				end
+			elseif ARL_SearchText:GetText() ~= "" then
+				StaticPopup_Show("ARL_SEARCHFILTERED")
 			else
-				clr2 = addon:hexcolor("NEUTRAL")
-				displaytt = true
+				addon:Print(L["NO_DISPLAY"])
+				addon:Print("DEBUG: recipes_total check for 0")
+				addon:Print("DEBUG: recipes_total: " .. Player.recipes_total)
+				addon:Print("DEBUG: recipes_total check for equal to recipes_total")
+				addon:Print("DEBUG: recipes_known: " .. Player.recipes_known)
+				addon:Print("DEBUG: recipes_total: " .. Player.recipes_total)
+				addon:Print("DEBUG: recipes_total_filtered - recipes_known_filtered = 0")
+				addon:Print("DEBUG: recipes_total_filtered: " .. Player.recipes_total_filtered)
+				addon:Print("DEBUG: recipes_known_filtered: " .. Player.recipes_known_filtered)
+				addon:Print("DEBUG: excluded_recipes_unknown ~= 0")
+				addon:Print("DEBUG: excluded_recipes_unknown: " .. Player.excluded_recipes_unknown)
 			end
+		end
+	end
+	local faction_strings

-			if displaytt then
-				if vendor["Coordx"] ~= 0 and vendor["Coordy"] ~= 0 then
-					cStr = "(" .. vendor["Coordx"] .. ", " .. vendor["Coordy"] .. ")"
-				end
-				ttAdd(0, -1, 0, L["Vendor"], clr1, vendor["Name"], clr2)
-				clr1 = addon:hexcolor("NORMAL")
-				clr2 = addon:hexcolor("HIGH")
-				ttAdd(1, -2, 1, vendor["Location"], clr1, cStr, clr2)
-			elseif faction then
-				ttAdd(0, -1, 0, faction.." "..L["Vendor"], clr1)
-			end
-		--@alpha@
-		else	-- Unhandled
-			ttAdd(0, -1, 0, L["Unhandled Recipe"], addon:hexcolor("NORMAL"))
-		--@end-alpha@
+	local function CheckDisplayFaction(faction)
+		if addon.db.profile.filters.general.faction then
+			return true
 		end
+		return (not faction or faction == BFAC[Player["Faction"]] or faction == FACTION_NEUTRAL)
 	end
-	arlTooltip:AddSeparator()
-	arlTooltip:AddSeparator()

-	clr1 = addon:hexcolor("NORMAL")
+	function MainPanel.scroll_frame:ExpandEntry(entry_index)
+		local obtain_filters = addon.db.profile.filters.obtain
+		local recipe_id = self.entries[entry_index].recipe_id
+		local pad = "  "

-	ttAdd(0, -1, 0, L["ALT_CLICK"], clr1)
-	ttAdd(0, -1, 0, L["CTRL_CLICK"], clr1)
-	ttAdd(0, -1, 0, L["SHIFT_CLICK"], clr1)
+		-- entry_index is the position in self.entries that we want
+		-- to expand. Since we are expanding the current entry, the return
+		-- value should be the index of the next button after the expansion
+		-- occurs
+		entry_index = entry_index + 1

-	if addon.db.profile.worldmap or addon.db.profile.minimap then
-		ttAdd(0, -1, 0, L["CTRL_SHIFT_CLICK"], clr1)
-	end
-	arlTooltip:Show()
+		for k, v in pairs(addon.recipe_list[recipe_id]["Acquire"]) do
+			-- Initialize the first line here, since every type below will have one.
+			local acquire_type = v["Type"]
+			local t = AcquireTable()
+			t.recipe_id = recipe_id
+			t.is_expanded = true

-	-- If we have the spell link tooltip, link it to the acquire tooltip.
-	if spellTooltipLocation ~= _G.OFF and spellLink then
-		SetSpellTooltip(arlTooltip, spellTooltipLocation, spellLink)
-	else
-		arlSpellTooltip:Hide()
-	end
-end
+			if acquire_type == A_TRAINER and obtain_filters.trainer then
+				local trainer = addon.trainer_list[v["ID"]]

-local Generic_MakeCheckButton
-do
-	local PUSHDOWN = {
-		["cloak"]	= true,
-		["necklace"]	= true,
-		["ring"]	= true,
-		["trinket"]	= true,
-		["shield"]	= true,
-	}
-	function Generic_MakeCheckButton(cButton, anchorFrame, ttText, scriptVal, row, col, misc)
-		-- set the position of the new checkbox
-		local xPos = 2 + ((col - 1) * 100)
-		local yPos = -3 - ((row - 1) * 17)
+				if CheckDisplayFaction(trainer["Faction"]) then
+					local nStr = ""

-		if PUSHDOWN[scriptVal] then
-			yPos = yPos - 5
-		end
-		cButton:SetPoint("TOPLEFT", anchorFrame, "TOPLEFT", xPos, yPos)
-		cButton:SetHeight(24)
-		cButton:SetWidth(24)
+					if trainer["Faction"] == FACTION_HORDE then
+						nStr = addon:Horde(trainer["Name"])
+					elseif trainer["Faction"] == FACTION_ALLIANCE then
+						nStr = addon:Alliance(trainer["Name"])
+					else
+						nStr = addon:Neutral(trainer["Name"])
+					end
+					t.text = pad .. addon:Trainer(L["Trainer"] .. " : ") .. nStr

-		-- depending if we're on the misc panel or not, set an alternative OnClick method
-		if misc == 0 then
-			cButton:SetScript("OnClick",
-					  function()
-						  FilterValueMap[scriptVal].svroot[scriptVal] = FilterValueMap[scriptVal].cb:GetChecked() and true or false
-						  MainPanel:UpdateTitle()
-						  ReDisplay()
-					  end)
-		else
-			cButton:SetScript("OnClick",
-					  function()
-						  addon.db.profile.ignoreexclusionlist = not addon.db.profile.ignoreexclusionlist
-						  ReDisplay()
-					  end)
-		end
-		SetTooltipScripts(cButton, ttText, 1)
-	end
-end	-- do
+					tinsert(self.entries, entry_index, t)
+					entry_index = entry_index + 1

--- Generic function for creating the expanded panel buttons
-local CreateFilterMenuButton
-do
-	local ExpButtonTT = {
-		L["FILTERING_GENERAL_DESC"],	-- 1
-		L["FILTERING_OBTAIN_DESC"],	-- 2
-		L["FILTERING_BINDING_DESC"],	-- 3
-		L["FILTERING_ITEM_DESC"],	-- 4
-		L["FILTERING_PLAYERTYPE_DESC"],	-- 5
-		L["FILTERING_REP_DESC"],	-- 6
-		L["FILTERING_MISC_DESC"]	-- 7
-	}
+					local cStr = ""

-	local function ToggleFilterMenu(panel)
-		-- This manages the filter menu panel, as well as checking or unchecking the
-		-- buttons that got us here in the first place
-		--
-		-- our panels are:
-		-- 1	ARL_ExpGeneralOptCB			General Filters
-		-- 2	ARL_ExpObtainOptCB			Obtain Filters
-		-- 3	ARL_ExpBindingOptCB			Binding Filters
-		-- 4	ARL_ExpItemOptCB			Item Filters
-		-- 5	ARL_ExpPlayerOptCB			Role Filters
-		-- 6	ARL_ExpRepOptCB				Reputation Filters
-		-- 7	ARL_ExpMiscOptCB			Miscellaneous Filters
+					if trainer["Coordx"] ~= 0 and trainer["Coordy"] ~= 0 then
+						cStr = addon:Coords("(" .. trainer["Coordx"] .. ", " .. trainer["Coordy"] .. ")")
+					end
+					t = AcquireTable()
+					t.recipe_id = recipe_id
+					t.is_expanded = true
+					t.text = pad .. pad .. trainer["Location"] .. " " .. cStr

-		local ChangeFilters = false
+					tinsert(self.entries, entry_index, t)
+					entry_index = entry_index + 1
+				end
+				-- Right now PVP obtained items are located on vendors so they have the vendor and pvp flag.
+				-- We need to display the vendor in the drop down if we want to see vendors or if we want to see PVP
+				-- This allows us to select PVP only and to see just the PVP recipes
+			elseif acquire_type == A_VENDOR and (obtain_filters.vendor or obtain_filters.pvp) then
+				local vendor = addon.vendor_list[v["ID"]]

-		MainPanel.filter_menu.Rep.Classic:Hide()
-		MainPanel.filter_menu.Rep.BC:Hide()
-		MainPanel.filter_menu.Rep.LK:Hide()
+				if CheckDisplayFaction(vendor["Faction"]) then
+					local nStr = ""

-		ARL_Rep_ClassicCB:SetChecked(false)
-		ARL_Rep_BCCB:SetChecked(false)
-		ARL_Rep_LKCB:SetChecked(false)
+					if vendor["Faction"] == FACTION_HORDE then
+						nStr = addon:Horde(vendor["Name"])
+					elseif vendor["Faction"] == FACTION_ALLIANCE then
+						nStr = addon:Alliance(vendor["Name"])
+					else
+						nStr = addon:Neutral(vendor["Name"])
+					end
+					t.text = pad .. addon:Vendor(L["Vendor"] .. " : ") .. nStr

-		if panel == 1 then
-			if ARL_ExpGeneralOptCB:GetChecked() then
-				-- uncheck all other buttons
-				HideARL_ExpOptCB("general")
+					tinsert(self.entries, entry_index, t)
+					entry_index = entry_index + 1

-				-- display the correct subframe with all the buttons and such, hide the others
-				MainPanel.filter_menu.General:Show()
-				MainPanel.filter_menu.Obtain:Hide()
-				MainPanel.filter_menu.Binding:Hide()
-				MainPanel.filter_menu.Item:Hide()
-				MainPanel.filter_menu.Player:Hide()
-				MainPanel.filter_menu.Rep:Hide()
-				MainPanel.filter_menu.Misc:Hide()
+					local cStr = ""

-				ChangeFilters = true
-			else
-				ARL_ExpGeneralOptCB.text:SetText(addon:Yellow(ExpButtonText[1]))
-				ChangeFilters = false
-			end
-		elseif panel == 2 then
-			if ARL_ExpObtainOptCB:GetChecked() then
-				HideARL_ExpOptCB("obtain")
-
-				-- display the correct subframe with all the buttons and such, hide the others
-				MainPanel.filter_menu.General:Hide()
-				MainPanel.filter_menu.Obtain:Show()
-				MainPanel.filter_menu.Binding:Hide()
-				MainPanel.filter_menu.Item:Hide()
-				MainPanel.filter_menu.Player:Hide()
-				MainPanel.filter_menu.Rep:Hide()
-				MainPanel.filter_menu.Misc:Hide()
+					if vendor["Coordx"] ~= 0 and vendor["Coordy"] ~= 0 then
+						cStr = addon:Coords("(" .. vendor["Coordx"] .. ", " .. vendor["Coordy"] .. ")")
+					end
+					t = AcquireTable()
+					t.recipe_id = recipe_id
+					t.is_expanded = true
+					t.text = pad .. pad .. vendor["Location"] .. " " .. cStr

-				ChangeFilters = true
-			else
-				ARL_ExpObtainOptCB.text:SetText(addon:Yellow(ExpButtonText[2]))
-				ChangeFilters = false
-			end
-		elseif panel == 3 then
-			if ARL_ExpBindingOptCB:GetChecked() then
-				HideARL_ExpOptCB("binding")
+					tinsert(self.entries, entry_index, t)
+					entry_index = entry_index + 1
+				end
+				-- Mobs can be in instances, raids, or specific mob related drops.
+			elseif acquire_type == A_MOB and (obtain_filters.mobdrop or obtain_filters.instance or obtain_filters.raid) then
+				local mob = addon.mob_list[v["ID"]]
+				t.text = pad .. addon:MobDrop(L["Mob Drop"] .. " : ") .. addon:Red(mob["Name"])

-				-- display the correct subframe with all the buttons and such, hide the others
-				MainPanel.filter_menu.General:Hide()
-				MainPanel.filter_menu.Obtain:Hide()
-				MainPanel.filter_menu.Binding:Show()
-				MainPanel.filter_menu.Item:Hide()
-				MainPanel.filter_menu.Player:Hide()
-				MainPanel.filter_menu.Rep:Hide()
-				MainPanel.filter_menu.Misc:Hide()
+				tinsert(self.entries, entry_index, t)
+				entry_index = entry_index + 1

-				ChangeFilters = true
-			else
-				ARL_ExpBindingOptCB.text:SetText(addon:Yellow(ExpButtonText[3]))
-				ChangeFilters = false
-			end
-		elseif panel == 4 then
-			if ARL_ExpItemOptCB:GetChecked() then
-				HideARL_ExpOptCB("item")
+				local cStr = ""

-				-- display the correct subframe with all the buttons and such, hide the others
-				MainPanel.filter_menu.General:Hide()
-				MainPanel.filter_menu.Obtain:Hide()
-				MainPanel.filter_menu.Binding:Hide()
-				MainPanel.filter_menu.Item:Show()
-				MainPanel.filter_menu.Player:Hide()
-				MainPanel.filter_menu.Rep:Hide()
-				MainPanel.filter_menu.Misc:Hide()
+				if mob["Coordx"] ~= 0 and mob["Coordy"] ~= 0 then
+					cStr = addon:Coords("(" .. mob["Coordx"] .. ", " .. mob["Coordy"] .. ")")
+				end
+				t = AcquireTable()
+				t.recipe_id = recipe_id
+				t.is_expanded = true
+				t.text = pad .. pad .. mob["Location"] .. " " .. cStr

-				ChangeFilters = true
-			else
-				ARL_ExpItemOptCB.text:SetText(addon:Yellow(ExpButtonText[4]))
-				ChangeFilters = false
-			end
-		elseif panel == 5 then
-			if ARL_ExpPlayerOptCB:GetChecked() then
-				HideARL_ExpOptCB("player")
+				tinsert(self.entries, entry_index, t)
+				entry_index = entry_index + 1
+			elseif acquire_type == A_QUEST and obtain_filters.quest then
+				local quest = addon.quest_list[v["ID"]]

-				-- display the correct subframe with all the buttons and such, hide the others
-				MainPanel.filter_menu.General:Hide()
-				MainPanel.filter_menu.Obtain:Hide()
-				MainPanel.filter_menu.Binding:Hide()
-				MainPanel.filter_menu.Item:Hide()
-				MainPanel.filter_menu.Player:Show()
-				MainPanel.filter_menu.Rep:Hide()
-				MainPanel.filter_menu.Misc:Hide()
+				if CheckDisplayFaction(quest["Faction"]) then
+					local nStr = ""

-				ChangeFilters = true
-			else
-				ARL_ExpPlayerOptCB.text:SetText(addon:Yellow(ExpButtonText[5]))
-				ChangeFilters = false
-			end
-		elseif panel == 6 then
-			if ARL_ExpRepOptCB:GetChecked() then
-				HideARL_ExpOptCB("rep")
+					if quest["Faction"] == FACTION_HORDE then
+						nStr = addon:Horde(quest["Name"])
+					elseif quest["Faction"] == FACTION_ALLIANCE then
+						nStr = addon:Alliance(quest["Name"])
+					else
+						nStr = addon:Neutral(quest["Name"])
+					end
+					t.text = pad .. addon:Quest(L["Quest"] .. " : ") .. nStr

-				-- display the correct subframe with all the buttons and such, hide the others
-				MainPanel.filter_menu.General:Hide()
-				MainPanel.filter_menu.Obtain:Hide()
-				MainPanel.filter_menu.Binding:Hide()
-				MainPanel.filter_menu.Item:Hide()
-				MainPanel.filter_menu.Player:Hide()
-				MainPanel.filter_menu.Rep:Show()
-				MainPanel.filter_menu.Misc:Hide()
+					tinsert(self.entries, entry_index, t)
+					entry_index = entry_index + 1

-				ChangeFilters = true
-			else
-				ARL_ExpRepOptCB.text:SetText(addon:Yellow(ExpButtonText[6]))
-				ChangeFilters = false
-			end
-		elseif panel == 7 then
-			if ARL_ExpMiscOptCB:GetChecked() then
-				HideARL_ExpOptCB("misc")
+					local cStr = ""

-				-- display the correct subframe with all the buttons and such, hide the others
-				MainPanel.filter_menu.General:Hide()
-				MainPanel.filter_menu.Obtain:Hide()
-				MainPanel.filter_menu.Binding:Hide()
-				MainPanel.filter_menu.Item:Hide()
-				MainPanel.filter_menu.Player:Hide()
-				MainPanel.filter_menu.Rep:Hide()
-				MainPanel.filter_menu.Misc:Show()
+					if quest["Coordx"] ~= 0 and quest["Coordy"] ~= 0 then
+						cStr = addon:Coords("(" .. quest["Coordx"] .. ", " .. quest["Coordy"] .. ")")
+					end
+					t = AcquireTable()
+					t.recipe_id = recipe_id
+					t.is_expanded = true
+					t.text = pad .. pad .. quest["Location"] .. " " .. cStr

-				ChangeFilters = true
-			else
-				ARL_ExpMiscOptCB.text:SetText(addon:Yellow(ExpButtonText[7]))
-				ChangeFilters = false
-			end
-		end
+					tinsert(self.entries, entry_index, t)
+					entry_index = entry_index + 1
+				end
+			elseif acquire_type == A_SEASONAL and obtain_filters.seasonal then
+				t.text = pad .. addon:Season(SEASONAL_CATEGORY .. " : " .. addon.seasonal_list[v["ID"]]["Name"])
+				tinsert(self.entries, entry_index, t)
+				entry_index = entry_index + 1
+			elseif acquire_type == A_REPUTATION then -- Need to check if we're displaying the currently id'd rep or not as well
+				-- Reputation Obtain
+				-- Rep: ID, Faction
+				-- RepLevel = 0 (Neutral), 1 (Friendly), 2 (Honored), 3 (Revered), 4 (Exalted)
+				-- RepVendor - VendorID
+				local rep_vendor = addon.vendor_list[v["RepVendor"]]

-		if ChangeFilters then
-			-- Depending on which panel we're showing, either display one column
-			-- or two column
-			if panel == 2 or panel == 3 or panel == 4 or panel == 7 then
-				MainPanel.filter_menu.texture:ClearAllPoints()
-				MainPanel.filter_menu:SetWidth(FILTERMENU_DOUBLE_WIDTH)
-				MainPanel.filter_menu.texture:SetTexture([[Interface\Addons\AckisRecipeList\img\fly_2col]])
-				MainPanel.filter_menu.texture:SetAllPoints(MainPanel.filter_menu)
-				MainPanel.filter_menu.texture:SetTexCoord(0, (FILTERMENU_DOUBLE_WIDTH/256), 0, (FILTERMENU_HEIGHT/512))
-			elseif ((panel == 1) or (panel == 5) or (panel == 6)) then
-				MainPanel.filter_menu.texture:ClearAllPoints()
-				MainPanel.filter_menu:SetWidth(FILTERMENU_SINGLE_WIDTH)
-				MainPanel.filter_menu.texture:SetTexture([[Interface\Addons\AckisRecipeList\img\fly_1col]])
-				MainPanel.filter_menu.texture:SetAllPoints(MainPanel.filter_menu)
-				MainPanel.filter_menu.texture:SetTexCoord(0, (FILTERMENU_SINGLE_WIDTH/256), 0, (FILTERMENU_HEIGHT/512))
-			end
-			-- Change the filters to the current panel
-			MainPanel.filter_menu:Show()
-		else
-			-- We're hiding, don't bother changing anything
-			MainPanel.filter_menu:Hide()
-		end
-	end
+				if CheckDisplayFaction(rep_vendor["Faction"]) then
+					t.text = pad .. addon:Rep(_G.REPUTATION .. " : ") .. addon.reputation_list[v["ID"]]["Name"]
+					tinsert(self.entries, entry_index, t)
+					entry_index = entry_index + 1

-	function CreateFilterMenuButton(bName, bTex, panelIndex)
-		local ExpTextureSize = 34
-		local cButton
+					if not faction_strings then
+						faction_strings = {
+							[0] = addon:Neutral(FACTION_NEUTRAL .. " : "),
+							[1] = addon:Friendly(BFAC["Friendly"] .. " : "),
+							[2] = addon:Honored(BFAC["Honored"] .. " : "),
+							[3] = addon:Revered(BFAC["Revered"] .. " : "),
+							[4] = addon:Exalted(BFAC["Exalted"] .. " : ")
+						}
+					end
+					local nStr = ""

-		if bName == "ARL_Rep_ClassicCB" or bName == "ARL_Rep_BCCB" or bName == "ARL_Rep_LKCB" then
-			cButton = CreateFrame("CheckButton", bName, MainPanel.filter_menu.Rep)
-			cButton:SetWidth(100)
-			cButton:SetHeight(46)
-			cButton:SetChecked(false)
-
-			local iconTex = cButton:CreateTexture(cButton:GetName() .. "buttonTex", "BORDER")
+					if rep_vendor["Faction"] == FACTION_HORDE then
+						nStr = addon:Horde(rep_vendor["Name"])
+					elseif rep_vendor["Faction"] == FACTION_ALLIANCE then
+						nStr = addon:Alliance(rep_vendor["Name"])
+					else
+						nStr = addon:Neutral(rep_vendor["Name"])
+					end
+					t = AcquireTable()
+					t.recipe_id = recipe_id
+					t.is_expanded = true

-			if bName == "ARL_Rep_LKCB" then
-				iconTex:SetTexture("Interface\\Addons\\AckisRecipeList\\img\\" .. bTex)
-			else
-				iconTex:SetTexture('Interface/Glues/Common/' .. bTex)
-			end
-			iconTex:SetWidth(100)
-			iconTex:SetHeight(46)
-			iconTex:SetAllPoints(cButton)
+					t.text = pad .. pad .. faction_strings[v["RepLevel"]] .. nStr

-			local pushedTexture = cButton:CreateTexture(cButton:GetName() .. "pTex", "ARTWORK")
-			pushedTexture:SetTexture('Interface/Buttons/UI-Quickslot-Depress')
-			pushedTexture:SetAllPoints(cButton)
-			cButton:SetPushedTexture(pushedTexture)
+					tinsert(self.entries, entry_index, t)
+					entry_index = entry_index + 1

-			local highlightTexture = cButton:CreateTexture()
-			highlightTexture:SetTexture('Interface/Buttons/ButtonHilight-Square')
-			highlightTexture:SetAllPoints(cButton)
-			highlightTexture:SetBlendMode('ADD')
-			cButton:SetHighlightTexture(highlightTexture)
+					local cStr = ""

-			local checkedTexture = cButton:CreateTexture()
-			checkedTexture:SetTexture('Interface/Buttons/CheckButtonHilight')
-			checkedTexture:SetAllPoints(cButton)
-			checkedTexture:SetBlendMode('ADD')
-			cButton:SetCheckedTexture(checkedTexture)
+					if rep_vendor["Coordx"] ~= 0 and rep_vendor["Coordy"] ~= 0 then
+						cStr = addon:Coords("(" .. rep_vendor["Coordx"] .. ", " .. rep_vendor["Coordy"] .. ")")
+					end
+					t = AcquireTable()
+					t.recipe_id = recipe_id
+					t.is_expanded = true
+					t.text = pad .. pad .. pad .. rep_vendor["Location"] .. " " .. cStr

-			-- And throw up a tooltip
-			if bName == "ARL_Rep_ClassicCB" then
-				SetTooltipScripts(cButton, L["FILTERING_OLDWORLD_DESC"])
-			elseif bName == "ARL_Rep_BCCB" then
-				SetTooltipScripts(cButton, L["FILTERING_BC_DESC"])
-			else
-				SetTooltipScripts(cButton, L["FILTERING_WOTLK_DESC"])
-			end
-		else
-			cButton = CreateFrame("CheckButton", bName, MainPanel) -- , "UICheckButtonTemplate")
-			cButton:SetWidth(ExpTextureSize)
-			cButton:SetHeight(ExpTextureSize)
-			cButton:SetScript("OnClick",
-					  function()
-						  ToggleFilterMenu(panelIndex)
-					  end)
-
-			local bgTex = cButton:CreateTexture(cButton:GetName() .. "bgTex", "BACKGROUND")
-			bgTex:SetTexture('Interface/SpellBook/UI-Spellbook-SpellBackground')
-			bgTex:SetHeight(ExpTextureSize + 6)
-			bgTex:SetWidth(ExpTextureSize + 4)
-			bgTex:SetTexCoord(0, (43/64), 0, (43/64))
-			bgTex:SetPoint("CENTER", cButton, "CENTER", 0, 0)
+					tinsert(self.entries, entry_index, t)
+					entry_index = entry_index + 1
+				end
+			elseif acquire_type == A_WORLD_DROP and obtain_filters.worlddrop then
+				t.text = pad .. addon:RarityColor(v["ID"] + 1, L["World Drop"])
+				tinsert(self.entries, entry_index, t)
+				entry_index = entry_index + 1
+			elseif acquire_type == A_CUSTOM then
+				t.text = pad .. addon:Normal(addon.custom_list[v["ID"]]["Name"])
+				tinsert(self.entries, entry_index, t)
+				entry_index = entry_index + 1
+			elseif acquire_type == A_PVP and obtain_filters.pvp then
+				local vendor = addon.vendor_list[v["ID"]]

-			local iconTex = cButton:CreateTexture(cButton:GetName() .. "iconTex", "BORDER")
-			iconTex:SetTexture('Interface/Icons/' .. bTex)
-			iconTex:SetAllPoints(cButton)
+				if CheckDisplayFaction(vendor["Faction"]) then
+					local cStr = ""

-			local pushedTexture = cButton:CreateTexture(cButton:GetName() .. "pTex", "ARTWORK")
-			pushedTexture:SetTexture('Interface/Buttons/UI-Quickslot-Depress')
-			pushedTexture:SetAllPoints(cButton)
-			cButton:SetPushedTexture(pushedTexture)
+					if vendor["Coordx"] ~= 0 and vendor["Coordy"] ~= 0 then
+						cStr = addon:Coords("(" .. vendor["Coordx"] .. ", " .. vendor["Coordy"] .. ")")
+					end
+					local nStr = ""

-			local highlightTexture = cButton:CreateTexture()
-			highlightTexture:SetTexture('Interface/Buttons/ButtonHilight-Square')
-			highlightTexture:SetAllPoints(cButton)
-			highlightTexture:SetBlendMode('ADD')
-			cButton:SetHighlightTexture(highlightTexture)
+					if vendor["Faction"] == FACTION_HORDE then
+						nStr = addon:Horde(vendor["Name"])
+					elseif vendor["Faction"] == FACTION_ALLIANCE then
+						nStr = addon:Alliance(vendor["Name"])
+					else
+						nStr = addon:Neutral(vendor["Name"])
+					end
+					t.text = pad .. addon:Vendor(L["Vendor"] .. " : ") .. nStr

-			local checkedTexture = cButton:CreateTexture()
-			checkedTexture:SetTexture('Interface/Buttons/CheckButtonHilight')
-			checkedTexture:SetAllPoints(cButton)
-			checkedTexture:SetBlendMode('ADD')
-			cButton:SetCheckedTexture(checkedTexture)
+					tinsert(self.entries, entry_index, t)
+					entry_index = entry_index + 1

-			-- Create the text object to go along with it
-			local cbText = cButton:CreateFontString("cbText", "OVERLAY", "GameFontHighlight")
-			cbText:SetText(addon:Yellow(ExpButtonText[panelIndex]))
-			cbText:SetPoint("LEFT", cButton, "RIGHT", 5, 0)
-			cbText:SetHeight(14)
-			cbText:SetWidth(100)
-			cbText:SetJustifyH("LEFT")
-			cButton.text = cbText
+					t = AcquireTable()
+					t.recipe_id = recipe_id
+					t.is_expanded = true
+					t.text = pad .. pad .. vendor["Location"] .. " " .. cStr

-			-- And throw up a tooltip
-			SetTooltipScripts(cButton, ExpButtonTT[panelIndex])
-			cButton:Hide()
+					tinsert(self.entries, entry_index, t)
+					entry_index = entry_index + 1
+				end
+				--@alpha@
+			elseif acquire_type > A_MAX then
+				t.text = "Unhandled Acquire Case - Type: " .. acquire_type
+				tinsert(self.entries, entry_index, t)
+				entry_index = entry_index + 1
+				--@end-alpha@
+			end
 		end
-		return cButton
+		return entry_index
 	end
 end	-- do

-local function SetSortName()
-	local sort_type = addon.db.profile.sorting
-
-	if sort_type == "Name" then
-		ARL_DD_SortText:SetText(L["Sort"] .. ": " .. _G.NAME)
-	elseif sort_type == "SkillAsc" then
-		ARL_DD_SortText:SetText(L["Sort"] .. ": " .. L["Skill (Asc)"])
-	elseif sort_type == "SkillDesc" then
-		ARL_DD_SortText:SetText(L["Sort"] .. ": " .. L["Skill (Desc)"])
-	elseif sort_type == "Acquisition" then
-		ARL_DD_SortText:SetText(L["Sort"] .. ": " .. L["Acquisition"])
-	elseif sort_type == "Location" then
-		ARL_DD_SortText:SetText(L["Sort"] .. ": " .. L["Location"])
-	end
+-------------------------------------------------------------------------------
+-- Create MainPanel.progress_bar and set its scripts
+-------------------------------------------------------------------------------
+do
+	-- Default values for the progressbar
+	local pbMin = 0
+	local pbMax = 100
+	local pbCur = 50

-end
+	MainPanel.progress_bar = CreateFrame("StatusBar", nil, MainPanel)
+	MainPanel.progress_bar:SetWidth(195)
+	MainPanel.progress_bar:SetHeight(14)

-local function ARL_DD_Sort_OnClick(button, value)
-	CloseDropDownMenus()
-	addon.db.profile.sorting = value
-	SetSortName()
-	ReDisplay()
-end
+	MainPanel.progress_bar:ClearAllPoints()
+	MainPanel.progress_bar:SetPoint("BOTTOMLEFT", MainPanel, 17, 7)

-local function ARL_DD_Sort_Initialize()
-	local info = UIDropDownMenu_CreateInfo()
+	MainPanel.progress_bar:SetStatusBarTexture("Interface\\Addons\\AckisRecipeList\\img\\progressbar")
+	MainPanel.progress_bar:SetOrientation("HORIZONTAL")
+	MainPanel.progress_bar:SetStatusBarColor(0.25, 0.25, 0.75)
+	MainPanel.progress_bar:SetMinMaxValues(pbMin, pbMax)
+	MainPanel.progress_bar:SetValue(pbCur)

-	local k = "Name"
-	info.text = k
-	info.arg1 = info.text
-	info.func = ARL_DD_Sort_OnClick
-	info.checked = (addon.db.profile.sorting == k)
-	UIDropDownMenu_AddButton(info)
+	MainPanel.progress_bar.text = MainPanel.progress_bar:CreateFontString(nil, "ARTWORK")
+	MainPanel.progress_bar.text:SetWidth(195)
+	MainPanel.progress_bar.text:SetHeight(14)
+	MainPanel.progress_bar.text:SetFontObject("GameFontHighlightSmall")

-	k = "SkillAsc"
-	info.text = k
-	info.arg1 = info.text
-	info.func = ARL_DD_Sort_OnClick
-	info.checked = (addon.db.profile.sorting == k)
-	UIDropDownMenu_AddButton(info)
+	MainPanel.progress_bar.text:ClearAllPoints()
+	MainPanel.progress_bar.text:SetPoint("CENTER", MainPanel.progress_bar, "CENTER", 0, 0)
+	MainPanel.progress_bar.text:SetJustifyH("CENTER")
+	MainPanel.progress_bar.text:SetFormattedText("%d / %d - %d%%", pbCur, pbMax, floor(pbCur / pbMax * 100))
+end	-- do

-	k = "SkillDesc"
-	info.text = k
-	info.arg1 = info.text
-	info.func = ARL_DD_Sort_OnClick
-	info.checked = (addon.db.profile.sorting == k)
-	UIDropDownMenu_AddButton(info)
+function MainPanel.progress_bar:Update()
+	local pbCur, pbMax
+	local settings = addon.db.profile

-	k = "Acquisition"
-	info.text = k
-	info.arg1 = info.text
-	info.func = ARL_DD_Sort_OnClick
-	info.checked = (addon.db.profile.sorting == k)
-	UIDropDownMenu_AddButton(info)
+	if settings.includefiltered then
+		pbCur = Player.recipes_known
+		pbMax = Player.recipes_total
+	else
+		-- We're removing filtered recipes from the final count
+		pbCur = Player.recipes_known_filtered
+		pbMax = Player.recipes_total_filtered
+	end

-	k = "Location"
-	info.text = k
-	info.arg1 = info.text
-	info.func = ARL_DD_Sort_OnClick
-	info.checked = (addon.db.profile.sorting == k)
-	UIDropDownMenu_AddButton(info)
+	if not settings.includeexcluded and not settings.ignoreexclusionlist then
+		pbCur = pbCur - Player.excluded_recipes_unknown
+		pbMax = pbMax - Player.excluded_recipes_known
+	end
+	self:SetMinMaxValues(0, pbMax)
+	self:SetValue(pbCur)

-	SetSortName()
+	if (floor(pbCur / pbMax * 100) < 101) and pbCur >= 0 and pbMax >= 0 then
+		self.text:SetFormattedText("%d / %d - %d%%", pbCur, pbMax, floor(pbCur / pbMax * 100))
+	else
+		self.text:SetFormattedText("0 / 0 - %s", L["NOT_YET_SCANNED"])
+	end
 end

 -------------------------------------------------------------------------------
--- Data used in GenerateClickableTT() and its support functions.
+-- Create the close button, and set its scripts.
 -------------------------------------------------------------------------------
-local click_info = {
-	anchor = nil,
-	change_realm = nil,
-	target_realm = nil,
-	modified = nil,
-	name = nil,
-	realm = nil,
-}
-local clicktip
-local GenerateClickableTT	-- Upvalued!
+MainPanel.close_button = GenericCreateButton(nil, MainPanel, 22, 69, "GameFontNormalSmall", "GameFontHighlightSmall", L["Close"], "CENTER", L["CLOSE_DESC"], 1)
+MainPanel.close_button:SetPoint("BOTTOMRIGHT", MainPanel, "BOTTOMRIGHT", -4, 3)
+
+MainPanel.close_button:SetScript("OnClick",
+				 function(self, button, down)
+					 MainPanel:Hide()
+				 end)

 -------------------------------------------------------------------------------
--- Clicktip OnMouseUp scripts.
+-- Map waypoint code.
 -------------------------------------------------------------------------------
-local function ChangeRealm(cell, arg, button)
-	click_info.modified = true
-	click_info.realm = nil
-	click_info.change_realm = true
-	click_info.target_realm = nil
-	GenerateClickableTT()
-end
-
-local function SelectRealm(cell, arg, button)
-	click_info.modified = true
-
-	if click_info.change_realm then
-		click_info.target_realm = arg
+do
+	local function LoadZones(c, y, ...)
+		-- Fill up the list for normal lookup
+		for i = 1, select('#', ...),1 do
+			c[i] = select(i,...)
+		end
+		-- Reverse lookup to make work easier later on
+		for i in pairs(c) do
+			y[c[i]] = i
+		end
 	end
-	click_info.realm = arg
-	GenerateClickableTT()
-end

-local function SelectName(cell, arg, button)
-	click_info.modified = true
-	click_info.name = arg
+	local C1 = {}
+	local C2 = {}
+	local C3 = {}
+	local C4 = {}
+	local c1 = {}
+	local c2 = {}
+	local c3 = {}
+	local c4 = {}

-	-- Wipe tradeskill information for the selected toon. -Torhal
-	if IsAltKeyDown() and button == "LeftButton" then
-		local tskl_list = addon.db.global.tradeskill
-		tskl_list[click_info.realm][click_info.name] = nil
+	LoadZones(C1, c1, GetMapZones(1))
+	LoadZones(C2, c2, GetMapZones(2))
+	LoadZones(C3, c3, GetMapZones(3))
+	LoadZones(C4, c4, GetMapZones(4))

-		-- See if there are any toons left on the realm. If not, nuke it as well.
-		local found = false
-		for name in pairs(tskl_list[click_info.realm]) do
-			found = true
-		end
-		if not found then
-			tskl_list[click_info.realm] = nil
-		end
-		local anchor = click_info.anchor
-		twipe(click_info)
-		click_info.anchor = anchor
-		GenerateClickableTT()
-		return
-	end
-	GenerateClickableTT()
-end
-
-local function SelectProfession(cell, arg, button)
-	local tskl_list = addon.db.global.tradeskill
-	click_info.modified = true
-	addon:Print(click_info.name .. " - " .. click_info.realm .. ": " .. tskl_list[click_info.realm][click_info.name][arg])
-end
-
--------------------------------------------------------------------------------
--- Creates a list of names/alts/etc in a tooltip which can be clicked.
--------------------------------------------------------------------------------
-function GenerateClickableTT(anchor)
-	local tskl_list = addon.db.global.tradeskill
-	local tip = clicktip
-	local y, x
-	local prealm = GetRealmName()
-	local target_realm = prealm
-
-	if click_info.change_realm then
-		target_realm = click_info.target_realm
-		click_info.change_realm = nil
-	end
-	tip:Clear()
-
-	if not click_info.realm then
-		local other_realms = nil
-		local header = nil
-		for realm in pairs(tskl_list) do
-			if target_realm and (realm ~= target_realm) then
-				other_realms = true
-			end
-
-			if not target_realm and (realm ~= prealm) then
-				if not header then
-					tip:AddHeader(L["Other Realms"])
-					tip:AddSeparator()
-					header = true
-				end
-				y, x = tip:AddLine()
-				tip:SetCell(y, x, realm)
-				tip:SetCellScript(y, x, "OnMouseUp", SelectRealm, realm)
-			elseif realm == target_realm then
-				tip:AddHeader(realm)
-				tip:AddSeparator()
+	local iconlist = {}

-				click_info.realm = realm
-				for name in pairs(tskl_list[click_info.realm]) do
-					if name ~= UnitName("player") then
-						y, x = tip:AddLine()
-						tip:SetCell(y, x, name)
-						tip:SetCellScript(y, x, "OnMouseUp", SelectName, name)
-					end
-				end
+	-- Clears all the icons from the world map and the mini-map
+	function addon:ClearMap()
+		if TomTom then
+			for i in pairs(iconlist) do
+				TomTom:RemoveWaypoint(iconlist[i])
 			end
+			iconlist = twipe(iconlist)
 		end
-		if other_realms then
-			tip:AddSeparator()
-			y, x = tip:AddLine()
-			tip:SetCell(y, x, L["Other Realms"])
-			tip:SetCellScript(y, x, "OnMouseUp", ChangeRealm)
-		end
-		tip:AddSeparator()
-	elseif not click_info.name then
-		local realm_list = tskl_list[click_info.realm]

-		if realm_list then
-			tip:AddLine(click_info.realm)
-			tip:AddSeparator()
-			for name in pairs(realm_list) do
-				y, x = tip:AddLine()
-				tip:SetCell(y, x, name)
-				tip:SetCellScript(y, x, "OnMouseUp", SelectName, name)
-			end
-			tip:AddSeparator()
-		end
-	else
-		tip:AddHeader(click_info.name)
-		tip:AddSeparator()
-		for prof in pairs(tskl_list[click_info.realm][click_info.name]) do
-			y, x = tip:AddLine()
-			tip:SetCell(y, x, prof)
-			tip:SetCellScript(y, x, "OnMouseUp", SelectProfession, prof)
-		end
-		tip:AddSeparator()
-	end
-	if anchor then
-		click_info.anchor = anchor
-		tip:SetPoint("TOP", anchor, "BOTTOM")
-	else
-		tip:SetPoint("TOP", click_info.anchor, "BOTTOM")
 	end
-	tip:Show()
-end
-
--------------------------------------------------------------------------------
--- Creates the initial frame to display recipes into.
--------------------------------------------------------------------------------
-function addon:InitializeFrame()
-	-------------------------------------------------------------------------------
-	-- Check to see if we're Horde or Alliance, and change the displayed
-	-- reputation strings to be faction-correct.
-	-------------------------------------------------------------------------------
-	local isAlliance = (Player["Faction"] == "Alliance")
-
-	local HonorHold_Thrallmar_FactionText = isAlliance and BFAC["Honor Hold"] or BFAC["Thrallmar"]
-	local Kurenai_Maghar_FactionText = isAlliance and BFAC["Kurenai"] or BFAC["The Mag'har"]
-	local Vanguard_Expedition_FactionText = isAlliance and BFAC["Alliance Vanguard"] or BFAC["Horde Expedition"]
-	local SilverConv_Sunreaver_FactionText = isAlliance and BFAC["The Silver Covenant"] or BFAC["The Sunreavers"]
-	local Valiance_Warsong_FactionText = isAlliance and BFAC["Valiance Expedition"] or BFAC["Warsong Offensive"]
-	local Frostborn_Taunka_FactionText = isAlliance and BFAC["The Frostborn"] or BFAC["The Taunka"]
-	local Explorer_Hand_FactionText = isAlliance and BFAC["Explorers' League"] or BFAC["The Hand of Vengeance"]
-
-	-------------------------------------------------------------------------------
-	-- Create the sort-type DropDown.
-	-------------------------------------------------------------------------------
-	local ARL_DD_Sort = CreateFrame("Frame", "ARL_DD_Sort", MainPanel, "UIDropDownMenuTemplate")
-	ARL_DD_Sort:SetPoint("TOPLEFT", MainPanel, "TOPLEFT", 55, -39)
-	ARL_DD_Sort:SetHitRectInsets(16, 16, 0, 0)
-	SetSortName()
-	UIDropDownMenu_SetWidth(ARL_DD_Sort, 105)
-
-	-------------------------------------------------------------------------------
-	-- Create the expand button and set its scripts.
-	-------------------------------------------------------------------------------
-	local ARL_ExpandButton = GenericCreateButton("ARL_ExpandButton", MainPanel, 21, 40, "GameFontNormalSmall", "GameFontHighlightSmall", L["EXPANDALL"], "CENTER",
-						     L["EXPANDALL_DESC"], 1)
-	ARL_ExpandButton:SetPoint("TOPRIGHT", ARL_DD_Sort, "BOTTOMLEFT", -2, 0)

-	ARL_ExpandButton:SetScript("OnClick",
-				   function(self, mouse_button, down)
-					   local expand_acquires = (self:GetText() == L["EXPANDALL"])
+	local function CheckMapDisplay(acquire_entry, flags)
+		local maptrainer = addon.db.profile.maptrainer
+		local mapquest = addon.db.profile.mapquest
+		local mapvendor = addon.db.profile.mapvendor
+		local mapmob = addon.db.profile.mapmob
+		local player_faction = Player["Faction"]
+		local acquire_type = acquire_entry["Type"]
+		local acquire_id = acquire_entry["ID"]
+		local display = false

-					   if expand_acquires then
-						   self:SetText(L["CONTRACTALL"])
-						   SetTooltipScripts(self, L["CONTRACTALL_DESC"])
-					   else
-						   self:SetText(L["EXPANDALL"])
-						   SetTooltipScripts(self, L["EXPANDALL_DESC"])
-					   end
-					   MainPanel.scroll_frame:Update(expand_acquires, false)
-				   end)
-	ARL_ExpandButton:SetText(L["EXPANDALL"])
-	SetTooltipScripts(ARL_ExpandButton, L["EXPANDALL_DESC"])
+		-- Trainers - Display if it's your faction or neutral.
+		if maptrainer then
+			if acquire_type == A_TRAINER then
+				local trainer = addon.trainer_list[acquire_id]

-	-------------------------------------------------------------------------------
-	-- The search button, clear button, and search entry box.
-	-------------------------------------------------------------------------------
-	local SearchRecipes
-	do
-		local search_params = {
-			["ItemID"]	= true,
-			["Name"]	= true,
-			["Locations"]	= true,
-			["Specialty"]	= true,
-			["Level"]	= true,
-			["Rarity"]	= true,
-		}
-		-- Scans through the recipe database and toggles the flag on if the item is in the search criteria
-		function SearchRecipes(pattern)
-			if not pattern then
-				return
+				display = (trainer["Faction"] == BFAC[player_faction] or trainer["Faction"] == FACTION_NEUTRAL)
+			elseif acquire_type == A_CUSTOM and flags[3] then
+				return true
 			end
-			pattern = pattern:lower()
-
-			local recipe_list = addon.recipe_list
-
-			for index in pairs(recipe_list) do
-				local entry = recipe_list[index]
-				entry["Search"] = false
-
-				for field in pairs(search_params) do
-					local str = entry[field] and tostring(entry[field]):lower() or nil
+			-- Vendors - Display if it's your faction or neutral
+		elseif mapvendor then
+			if acquire_type == A_VENDOR then
+				local vendor = addon.vendor_list[acquire_id]

-					if str and str:find(pattern) then
-						entry["Search"] = true
-						break
-					end
-				end
+				display = (vendor["Faction"] == BFAC[player_faction] or vendor["Faction"] == FACTION_NEUTRAL)
+			elseif acquire_type == A_CUSTOM and flags[4] then
+				return true
+			end
+			-- Always display mobs
+		elseif (acquire_type == A_MOB and mapmob) or
+			(acquire_type == A_CUSTOM and (flags[5] or flags[6] or flags[10] or flags[11])) then
+			return true
+		-- Quests
+		elseif mapquest then
+			if acquire_type == A_QUEST then
+				local quest = addon.quest_list[acquire_id]
+				display = (quest["Faction"] == BFAC[player_faction] or quest["Faction"] == FACTION_NEUTRAL)
+			elseif acquire_type == A_CUSTOM and flags[8] then
+				return true
 			end
 		end
-	end	-- do
-
-	local ARL_SearchButton = GenericCreateButton("ARL_SearchButton", MainPanel, 25, 74, "GameFontDisableSmall", "GameFontHighlightSmall", _G.SEARCH, "CENTER",
-						     L["SEARCH_DESC"], 1)
-	ARL_SearchButton:SetPoint("TOPLEFT", ARL_DD_Sort, "BOTTOMRIGHT", 1, 4)
-
-	ARL_SearchButton:Disable()
-	ARL_SearchButton:SetScript("OnClick",
-				   function(this)
-					   local searchtext = ARL_SearchText:GetText()
-					   searchtext = searchtext:trim()
-
-					   if (searchtext ~= "") then
-						   ARL_LastSearchedText = searchtext
-
-						   SearchRecipes(searchtext)
-						   MainPanel.scroll_frame:Update(false, false)
-
-						   ARL_ExpandButton:SetText(L["EXPANDALL"])
-						   SetTooltipScripts(ARL_ExpandButton, L["EXPANDALL_DESC"])
-
-						   ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall")
-						   ARL_SearchButton:Disable()
-					   end
-				   end)
+		return display
+	end

-	local ARL_ClearButton = GenericCreateButton("ARL_ClearButton", MainPanel, 28, 28, "GameFontNormalSmall", "GameFontHighlightSmall", "", "CENTER", L["CLEAR_DESC"], 3)
-	ARL_ClearButton:SetPoint("RIGHT", ARL_SearchButton, "LEFT", 4, -1)
+	local BZ = LibStub("LibBabble-Zone-3.0"):GetLookupTable()

-	ARL_ClearButton:SetScript("OnClick",
-				  function()
-					  local recipe_list = addon.recipe_list
+	local INSTANCE_LOCATIONS = {
+		[BZ["Ahn'kahet: The Old Kingdom"]] = {
+			["loc"] = c1[BZ["Dragonblight"]],
+			["c"] = 4,
+		},
+		[BZ["Auchenai Crypts"]] = {
+			["loc"] = c1[BZ["Terokkar Forest"]],
+			["c"] = 3,
+		},
+		[BZ["Azjol-Nerub"]] = {
+			["loc"] = c1[BZ["Dragonblight"]],
+			["c"] = 4,
+		},
+		[BZ["Blackrock Depths"]] = {
+			["loc"] = c1[BZ["Searing Gorge"]],
+			["c"] = 2,
+		},
+		[BZ["Blackrock Spire"]] = {
+			["loc"] = c1[BZ["Searing Gorge"]],
+			["c"] = 2,
+		},
+		[BZ["Blackwing Lair"]] = {
+			["loc"] = c1[BZ["Searing Gorge"]],
+			["c"] = 2,
+		},
+		[BZ["Dire Maul"]] = {
+			["loc"] = c1[BZ["Feralas"]],
+			["c"] = 1,
+		},
+		[BZ["Drak'Tharon Keep"]] = {
+			["loc"] = c1[BZ["Zul'Drak"]],
+			["c"] = 4,
+		},
+		[BZ["Gnomeregan"]] = {
+			["loc"] = c1[BZ["Dun Morogh"]],
+			["c"] = 2,
+		},
+		[BZ["Halls of Lightning"]] = {
+			["loc"] = c1[BZ["The Storm Peaks"]],
+			["c"] = 4,
+		},
+		[BZ["Halls of Stone"]] = {
+			["loc"] = c1[BZ["The Storm Peaks"]],
+			["c"] = 4,
+		},
+		[BZ["Karazhan"]] = {
+			["loc"] = c1[BZ["Deadwind Pass"]],
+			["c"] = 2,
+		},
+		[BZ["Magisters' Terrace"]] = {
+			["loc"] = c1[BZ["Isle of Quel'Danas"]],
+			["c"] = 3,
+		},
+		[BZ["Mana-Tombs"]] = {
+			["loc"] = c1[BZ["Terokkar Forest"]],
+			["c"] = 3,
+		},
+		[BZ["The Oculus"]] = {
+			["loc"] = c1[BZ["Borean Tundra"]],
+			["c"] = 4,
+		},
+		[BZ["Old Hillsbrad Foothills"]] = {
+			["loc"] = c1[BZ["Tanaris"]],
+			["c"] = 1,
+		},
+		[BZ["Onyxia's Lair"]] = {
+			["loc"] = c1[BZ["Dustwallow Marsh"]],
+			["c"] = 1,
+		},
+		[BZ["Ruins of Ahn'Qiraj"]] = {
+			["loc"] = c1[BZ["Tanaris"]],
+			["c"] = 1,
+		},
+		[BZ["Scholomance"]] = {
+			["loc"] = c1[BZ["Western Plaguelands"]],
+			["c"] = 2,
+		},
+		[BZ["Sethekk Halls"]] = {
+			["loc"] = c1[BZ["Terokkar Forest"]],
+			["c"] = 3,
+		},
+		[BZ["Shadow Labyrinth"]] = {
+			["loc"] = c1[BZ["Terokkar Forest"]],
+			["c"] = 3,
+		},
+		[BZ["Stratholme"]] = {
+			["loc"] = c1[BZ["Eastern Plaguelands"]],
+			["c"] = 2,
+		},
+		[BZ["Temple of Ahn'Qiraj"]] = {
+			["loc"] = c1[BZ["Tanaris"]],
+			["c"] = 1,
+		},
+		[BZ["The Arcatraz"]] = {
+			["loc"] = c1[BZ["Netherstorm"]],
+			["c"] = 3,
+		},
+		[BZ["The Black Morass"]] = {
+			["loc"] = c1[BZ["Tanaris"]],
+			["c"] = 1,
+		},
+		[BZ["The Botanica"]] = {
+			["loc"] = c1[BZ["Netherstorm"]],
+			["c"] = 3,
+		},
+		[BZ["The Deadmines"]] = {
+			["loc"] = c1[BZ["Westfall"]],
+			["c"] = 2,
+		},
+		[BZ["The Mechanar"]] = {
+			["loc"] = c1[BZ["Netherstorm"]],
+			["c"] = 3,
+		},
+		[BZ["The Nexus"]] = {
+			["loc"] = c1[BZ["Borean Tundra"]],
+			["c"] = 4,
+		},
+		[BZ["The Shattered Halls"]] = {
+			["loc"] = c1[BZ["Hellfire Peninsula"]],
+			["c"] = 3,
+		},
+		[BZ["The Slave Pens"]] = {
+			["loc"] = c1[BZ["Zangarmarsh"]],
+			["c"] = 3,
+		},
+		[BZ["The Steamvault"]] = {
+			["loc"] = c1[BZ["Zangarmarsh"]],
+			["c"] = 3,
+		},
+		[BZ["The Temple of Atal'Hakkar"]] = {
+			["loc"] = c1[BZ["Swamp of Sorrows"]],
+			["c"] = 2,
+		},
+		[BZ["The Violet Hold"]] = {
+			["loc"] = c1[BZ["Dalaran"]],
+			["c"] = 4,
+		},
+		[BZ["Utgarde Keep"]] = {
+			["loc"] = c1[BZ["Howling Fjord"]],
+			["c"] = 4,
+		},
+		[BZ["Utgarde Pinnacle"]] = {
+			["loc"] = c1[BZ["Howling Fjord"]],
+			["c"] = 4,
+		},
+		[BZ["Zul'Gurub"]] = {
+			["loc"] = c1[BZ["Stranglethorn Vale"]],
+			["c"] = 2,
+		},
+	}
+
+	local maplist = {}
+
+	-- Description: Adds mini-map and world map icons with tomtom.
+	-- Expected result: Icons are added to the world map and mini-map.
+	-- Input: An optional recipe ID
+	-- Output: Points are added to the maps
+	function addon:SetupMap(single_recipe)
+		if not TomTom then
+			return
+		end
+
+		local worldmap = addon.db.profile.worldmap
+		local minimap = addon.db.profile.minimap
+
+		if not (worldmap or minimap) then
+			return
+		end
+
+		local icontext = "Interface\\AddOns\\AckisRecipeList\\img\\enchant_up"
+
+		-- Get the proper icon to put on the mini-map
+		--		for i, k in pairs(SortedProfessions) do
+		--			if (k["name"] == Player["Profession"]) then
+		--				icontext = "Interface\\AddOns\\AckisRecipeList\\img\\" .. k["texture"] .. "_up"
+		--				break
+		--			end
+		--		end
+
+		twipe(maplist)
+
+		local recipe_list = addon.recipe_list
+
+		-- We're only getting a single recipe, not a bunch
+		if single_recipe then
+			-- loop through acquire methods, display each
+			for k, v in pairs(recipe_list[single_recipe]["Acquire"]) do
+				if CheckMapDisplay(v, recipe_list[single_recipe]["Flags"]) then
+					maplist[v["ID"]] = v["Type"]
+				end
+			end
+		elseif addon.db.profile.autoscanmap then
+			local sorted_recipes = addon.sorted_recipes
+
+			-- Scan through all recipes to display, and add the vendors to a list to get their acquire info
+			for i = 1, #sorted_recipes do
+				local recipe_index = sorted_recipes[i]
+
+				if recipe_list[recipe_index]["Display"] and recipe_list[recipe_index]["Search"] then
+					-- loop through acquire methods, display each
+					for k, v in pairs(recipe_list[recipe_index]["Acquire"]) do
+						if CheckMapDisplay(v, recipe_list[recipe_index]["Flags"]) then
+							maplist[v["ID"]] = v["Type"]
+						end
+					end
+				end
+			end
+		end
+
+		--		local ARLWorldMap = CreateFrame("Button","ARLWorldMap",WorldMapDetailFrame)
+		--		ARLWorldMap:ClearAllPoints()
+		--		ARLWorldMap:SetWidth(8)
+		--		ARLWorldMap:SetHeight(8)
+		--		ARLWorldMap.icon = ARLWorldMap:CreateTexture("ARTWORK")
+		--		ARLWorldMap.icon:SetTexture(icontext)
+		--		ARLWorldMap.icon:SetAllPoints()
+
+		--		local ARLMiniMap = CreateFrame("Button","ARLMiniMap",MiniMap)
+		--		ARLMiniMap:ClearAllPoints()
+		--		ARLMiniMap:SetWidth(8)
+		--		ARLMiniMap:SetHeight(8)
+		--		ARLMiniMap.icon = ARLMiniMap:CreateTexture("ARTWORK")
+		--		ARLMiniMap.icon:SetTexture(icontext)
+		--		ARLMiniMap.icon:SetAllPoints()
+
+		for k, j in pairs(maplist) do
+			local loc
+			local custom = false
+
+			-- Get the entries location
+			if maplist[k] == A_TRAINER then
+				loc = addon.trainer_list[k]
+			elseif maplist[k] == A_VENDOR then
+				loc = addon.vendor_list[k]
+			elseif maplist[k] == A_MOB then
+				loc = addon.mob_list[k]
+			elseif maplist[k] == A_QUEST then
+				loc = addon.quest_list[k]
+			elseif maplist[k] == A_CUSTOM then
+				loc = addon.custom_list[k]
+				custom = true
+			end
+
+			local name = loc["Name"]
+			local x = loc["Coordx"]
+			local y = loc["Coordy"]
+			local location = loc["Location"]
+			local continent, zone
+
+			if not loc then
+				--@alpha@
+				addon:Print("DEBUG: No continent/zone map match for ID " .. k .. " - loc is nil.")
+				--@end-alpha@
+			elseif c1[location] then
+				continent = 1
+				zone = c1[location]
+			elseif c2[location] then
+				continent = 2
+				zone = c2[location]
+			elseif c3[location] then
+				continent = 3
+				zone = c3[location]
+			elseif c4[location] then
+				continent = 4
+				zone = c4[location]
+			elseif INSTANCE_LOCATIONS[location] then
+				continent = INSTANCE_LOCATIONS[location]["c"]
+				zone = INSTANCE_LOCATIONS[location]["loc"]
+				name = name .. " (" .. location .. ")"
+			else
+				--@alpha@
+				addon:Print("DEBUG: No continent/zone map match for ID " .. k .. " Location: " .. location)
+				--@end-alpha@
+			end
+
+			--@alpha@
+			if (x < -100) or (x > 100) or (y < -100) or (y > 100) then
+				addon:Print("DEBUG: Invalid location coordinates for ID " .. k .. " Location: " .. location)
+			end
+			--@end-alpha@
+
+			if zone and continent then
+				--@alpha@
+				if (x == 0) and (y == 0) then
+					addon:Print("DEBUG: Location is 0,0 for ID " .. k .. " Location: " .. location)
+				end
+				--@end-alpha@
+				local iconuid = TomTom:AddZWaypoint(continent, zone, x, y, nil, false, minimap, worldmap)
+
+				tinsert(iconlist, iconuid)
+			end
+
+		end
+	end
+end -- do block
+
+-- Description: Converting from hex to rgb (Thanks Maldivia)
+local function toRGB(hex)
+	local r, g, b = hex:match("(..)(..)(..)")
+
+	return (tonumber(r, 16) / 256), (tonumber(g,16) / 256), (tonumber(b, 16) / 256)
+end
+
+local Generic_MakeCheckButton
+do
+	local PUSHDOWN = {
+		["cloak"]	= true,
+		["necklace"]	= true,
+		["ring"]	= true,
+		["trinket"]	= true,
+		["shield"]	= true,
+	}
+	function Generic_MakeCheckButton(cButton, anchorFrame, ttText, scriptVal, row, col, misc)
+		-- set the position of the new checkbox
+		local xPos = 2 + ((col - 1) * 100)
+		local yPos = -3 - ((row - 1) * 17)
+
+		if PUSHDOWN[scriptVal] then
+			yPos = yPos - 5
+		end
+		cButton:SetPoint("TOPLEFT", anchorFrame, "TOPLEFT", xPos, yPos)
+		cButton:SetHeight(24)
+		cButton:SetWidth(24)
+
+		-- depending if we're on the misc panel or not, set an alternative OnClick method
+		if misc == 0 then
+			cButton:SetScript("OnClick",
+					  function()
+						  FilterValueMap[scriptVal].svroot[scriptVal] = FilterValueMap[scriptVal].cb:GetChecked() and true or false
+						  MainPanel:UpdateTitle()
+						  ReDisplay()
+					  end)
+		else
+			cButton:SetScript("OnClick",
+					  function()
+						  addon.db.profile.ignoreexclusionlist = not addon.db.profile.ignoreexclusionlist
+						  ReDisplay()
+					  end)
+		end
+		SetTooltipScripts(cButton, ttText, 1)
+	end
+end	-- do
+
+-- Generic function for creating the expanded panel buttons
+local CreateFilterMenuButton
+do
+	local ExpButtonTT = {
+		L["FILTERING_GENERAL_DESC"],	-- 1
+		L["FILTERING_OBTAIN_DESC"],	-- 2
+		L["FILTERING_BINDING_DESC"],	-- 3
+		L["FILTERING_ITEM_DESC"],	-- 4
+		L["FILTERING_PLAYERTYPE_DESC"],	-- 5
+		L["FILTERING_REP_DESC"],	-- 6
+		L["FILTERING_MISC_DESC"]	-- 7
+	}
+
+	local function ToggleFilterMenu(panel)
+		-- This manages the filter menu panel, as well as checking or unchecking the
+		-- buttons that got us here in the first place
+		--
+		-- our panels are:
+		-- 1	ARL_ExpGeneralOptCB			General Filters
+		-- 2	ARL_ExpObtainOptCB			Obtain Filters
+		-- 3	ARL_ExpBindingOptCB			Binding Filters
+		-- 4	ARL_ExpItemOptCB			Item Filters
+		-- 5	ARL_ExpPlayerOptCB			Role Filters
+		-- 6	ARL_ExpRepOptCB				Reputation Filters
+		-- 7	ARL_ExpMiscOptCB			Miscellaneous Filters
+
+		local ChangeFilters = false
+
+		MainPanel.filter_menu.Rep.Classic:Hide()
+		MainPanel.filter_menu.Rep.BC:Hide()
+		MainPanel.filter_menu.Rep.LK:Hide()
+
+		ARL_Rep_ClassicCB:SetChecked(false)
+		ARL_Rep_BCCB:SetChecked(false)
+		ARL_Rep_LKCB:SetChecked(false)
+
+		if panel == 1 then
+			if ARL_ExpGeneralOptCB:GetChecked() then
+				-- uncheck all other buttons
+				HideARL_ExpOptCB("general")
+
+				-- display the correct subframe with all the buttons and such, hide the others
+				MainPanel.filter_menu.General:Show()
+				MainPanel.filter_menu.Obtain:Hide()
+				MainPanel.filter_menu.Binding:Hide()
+				MainPanel.filter_menu.Item:Hide()
+				MainPanel.filter_menu.Player:Hide()
+				MainPanel.filter_menu.Rep:Hide()
+				MainPanel.filter_menu.Misc:Hide()
+
+				ChangeFilters = true
+			else
+				ARL_ExpGeneralOptCB.text:SetText(addon:Yellow(ExpButtonText[1]))
+				ChangeFilters = false
+			end
+		elseif panel == 2 then
+			if ARL_ExpObtainOptCB:GetChecked() then
+				HideARL_ExpOptCB("obtain")
+
+				-- display the correct subframe with all the buttons and such, hide the others
+				MainPanel.filter_menu.General:Hide()
+				MainPanel.filter_menu.Obtain:Show()
+				MainPanel.filter_menu.Binding:Hide()
+				MainPanel.filter_menu.Item:Hide()
+				MainPanel.filter_menu.Player:Hide()
+				MainPanel.filter_menu.Rep:Hide()
+				MainPanel.filter_menu.Misc:Hide()
+
+				ChangeFilters = true
+			else
+				ARL_ExpObtainOptCB.text:SetText(addon:Yellow(ExpButtonText[2]))
+				ChangeFilters = false
+			end
+		elseif panel == 3 then
+			if ARL_ExpBindingOptCB:GetChecked() then
+				HideARL_ExpOptCB("binding")
+
+				-- display the correct subframe with all the buttons and such, hide the others
+				MainPanel.filter_menu.General:Hide()
+				MainPanel.filter_menu.Obtain:Hide()
+				MainPanel.filter_menu.Binding:Show()
+				MainPanel.filter_menu.Item:Hide()
+				MainPanel.filter_menu.Player:Hide()
+				MainPanel.filter_menu.Rep:Hide()
+				MainPanel.filter_menu.Misc:Hide()
+
+				ChangeFilters = true
+			else
+				ARL_ExpBindingOptCB.text:SetText(addon:Yellow(ExpButtonText[3]))
+				ChangeFilters = false
+			end
+		elseif panel == 4 then
+			if ARL_ExpItemOptCB:GetChecked() then
+				HideARL_ExpOptCB("item")
+
+				-- display the correct subframe with all the buttons and such, hide the others
+				MainPanel.filter_menu.General:Hide()
+				MainPanel.filter_menu.Obtain:Hide()
+				MainPanel.filter_menu.Binding:Hide()
+				MainPanel.filter_menu.Item:Show()
+				MainPanel.filter_menu.Player:Hide()
+				MainPanel.filter_menu.Rep:Hide()
+				MainPanel.filter_menu.Misc:Hide()
+
+				ChangeFilters = true
+			else
+				ARL_ExpItemOptCB.text:SetText(addon:Yellow(ExpButtonText[4]))
+				ChangeFilters = false
+			end
+		elseif panel == 5 then
+			if ARL_ExpPlayerOptCB:GetChecked() then
+				HideARL_ExpOptCB("player")
+
+				-- display the correct subframe with all the buttons and such, hide the others
+				MainPanel.filter_menu.General:Hide()
+				MainPanel.filter_menu.Obtain:Hide()
+				MainPanel.filter_menu.Binding:Hide()
+				MainPanel.filter_menu.Item:Hide()
+				MainPanel.filter_menu.Player:Show()
+				MainPanel.filter_menu.Rep:Hide()
+				MainPanel.filter_menu.Misc:Hide()
+
+				ChangeFilters = true
+			else
+				ARL_ExpPlayerOptCB.text:SetText(addon:Yellow(ExpButtonText[5]))
+				ChangeFilters = false
+			end
+		elseif panel == 6 then
+			if ARL_ExpRepOptCB:GetChecked() then
+				HideARL_ExpOptCB("rep")
+
+				-- display the correct subframe with all the buttons and such, hide the others
+				MainPanel.filter_menu.General:Hide()
+				MainPanel.filter_menu.Obtain:Hide()
+				MainPanel.filter_menu.Binding:Hide()
+				MainPanel.filter_menu.Item:Hide()
+				MainPanel.filter_menu.Player:Hide()
+				MainPanel.filter_menu.Rep:Show()
+				MainPanel.filter_menu.Misc:Hide()
+
+				ChangeFilters = true
+			else
+				ARL_ExpRepOptCB.text:SetText(addon:Yellow(ExpButtonText[6]))
+				ChangeFilters = false
+			end
+		elseif panel == 7 then
+			if ARL_ExpMiscOptCB:GetChecked() then
+				HideARL_ExpOptCB("misc")
+
+				-- display the correct subframe with all the buttons and such, hide the others
+				MainPanel.filter_menu.General:Hide()
+				MainPanel.filter_menu.Obtain:Hide()
+				MainPanel.filter_menu.Binding:Hide()
+				MainPanel.filter_menu.Item:Hide()
+				MainPanel.filter_menu.Player:Hide()
+				MainPanel.filter_menu.Rep:Hide()
+				MainPanel.filter_menu.Misc:Show()
+
+				ChangeFilters = true
+			else
+				ARL_ExpMiscOptCB.text:SetText(addon:Yellow(ExpButtonText[7]))
+				ChangeFilters = false
+			end
+		end
+
+		if ChangeFilters then
+			-- Depending on which panel we're showing, either display one column
+			-- or two column
+			if panel == 2 or panel == 3 or panel == 4 or panel == 7 then
+				MainPanel.filter_menu.texture:ClearAllPoints()
+				MainPanel.filter_menu:SetWidth(FILTERMENU_DOUBLE_WIDTH)
+				MainPanel.filter_menu.texture:SetTexture([[Interface\Addons\AckisRecipeList\img\fly_2col]])
+				MainPanel.filter_menu.texture:SetAllPoints(MainPanel.filter_menu)
+				MainPanel.filter_menu.texture:SetTexCoord(0, (FILTERMENU_DOUBLE_WIDTH/256), 0, (FILTERMENU_HEIGHT/512))
+			elseif ((panel == 1) or (panel == 5) or (panel == 6)) then
+				MainPanel.filter_menu.texture:ClearAllPoints()
+				MainPanel.filter_menu:SetWidth(FILTERMENU_SINGLE_WIDTH)
+				MainPanel.filter_menu.texture:SetTexture([[Interface\Addons\AckisRecipeList\img\fly_1col]])
+				MainPanel.filter_menu.texture:SetAllPoints(MainPanel.filter_menu)
+				MainPanel.filter_menu.texture:SetTexCoord(0, (FILTERMENU_SINGLE_WIDTH/256), 0, (FILTERMENU_HEIGHT/512))
+			end
+			-- Change the filters to the current panel
+			MainPanel.filter_menu:Show()
+		else
+			-- We're hiding, don't bother changing anything
+			MainPanel.filter_menu:Hide()
+		end
+	end
+
+	function CreateFilterMenuButton(bName, bTex, panelIndex)
+		local ExpTextureSize = 34
+		local cButton
+
+		if bName == "ARL_Rep_ClassicCB" or bName == "ARL_Rep_BCCB" or bName == "ARL_Rep_LKCB" then
+			cButton = CreateFrame("CheckButton", bName, MainPanel.filter_menu.Rep)
+			cButton:SetWidth(100)
+			cButton:SetHeight(46)
+			cButton:SetChecked(false)
+
+			local iconTex = cButton:CreateTexture(cButton:GetName() .. "buttonTex", "BORDER")
+
+			if bName == "ARL_Rep_LKCB" then
+				iconTex:SetTexture("Interface\\Addons\\AckisRecipeList\\img\\" .. bTex)
+			else
+				iconTex:SetTexture('Interface/Glues/Common/' .. bTex)
+			end
+			iconTex:SetWidth(100)
+			iconTex:SetHeight(46)
+			iconTex:SetAllPoints(cButton)
+
+			local pushedTexture = cButton:CreateTexture(cButton:GetName() .. "pTex", "ARTWORK")
+			pushedTexture:SetTexture('Interface/Buttons/UI-Quickslot-Depress')
+			pushedTexture:SetAllPoints(cButton)
+			cButton:SetPushedTexture(pushedTexture)
+
+			local highlightTexture = cButton:CreateTexture()
+			highlightTexture:SetTexture('Interface/Buttons/ButtonHilight-Square')
+			highlightTexture:SetAllPoints(cButton)
+			highlightTexture:SetBlendMode('ADD')
+			cButton:SetHighlightTexture(highlightTexture)
+
+			local checkedTexture = cButton:CreateTexture()
+			checkedTexture:SetTexture('Interface/Buttons/CheckButtonHilight')
+			checkedTexture:SetAllPoints(cButton)
+			checkedTexture:SetBlendMode('ADD')
+			cButton:SetCheckedTexture(checkedTexture)
+
+			-- And throw up a tooltip
+			if bName == "ARL_Rep_ClassicCB" then
+				SetTooltipScripts(cButton, L["FILTERING_OLDWORLD_DESC"])
+			elseif bName == "ARL_Rep_BCCB" then
+				SetTooltipScripts(cButton, L["FILTERING_BC_DESC"])
+			else
+				SetTooltipScripts(cButton, L["FILTERING_WOTLK_DESC"])
+			end
+		else
+			cButton = CreateFrame("CheckButton", bName, MainPanel) -- , "UICheckButtonTemplate")
+			cButton:SetWidth(ExpTextureSize)
+			cButton:SetHeight(ExpTextureSize)
+			cButton:SetScript("OnClick",
+					  function()
+						  ToggleFilterMenu(panelIndex)
+					  end)
+
+			local bgTex = cButton:CreateTexture(cButton:GetName() .. "bgTex", "BACKGROUND")
+			bgTex:SetTexture('Interface/SpellBook/UI-Spellbook-SpellBackground')
+			bgTex:SetHeight(ExpTextureSize + 6)
+			bgTex:SetWidth(ExpTextureSize + 4)
+			bgTex:SetTexCoord(0, (43/64), 0, (43/64))
+			bgTex:SetPoint("CENTER", cButton, "CENTER", 0, 0)

-					  -- Reset the search flags
-					  for index in pairs(recipe_list) do
-						  recipe_list[index]["Search"] = true
-					  end
-					  ARL_SearchText:SetText(L["SEARCH_BOX_DESC"])
+			local iconTex = cButton:CreateTexture(cButton:GetName() .. "iconTex", "BORDER")
+			iconTex:SetTexture('Interface/Icons/' .. bTex)
+			iconTex:SetAllPoints(cButton)

-					  -- Make sure our expand all button is set to expandall
-					  ARL_ExpandButton:SetText(L["EXPANDALL"])
-					  SetTooltipScripts(ARL_ExpandButton, L["EXPANDALL_DESC"])
+			local pushedTexture = cButton:CreateTexture(cButton:GetName() .. "pTex", "ARTWORK")
+			pushedTexture:SetTexture('Interface/Buttons/UI-Quickslot-Depress')
+			pushedTexture:SetAllPoints(cButton)
+			cButton:SetPushedTexture(pushedTexture)

-					  -- Make sure to clear the focus of the searchbox
-					  ARL_SearchText:ClearFocus()
+			local highlightTexture = cButton:CreateTexture()
+			highlightTexture:SetTexture('Interface/Buttons/ButtonHilight-Square')
+			highlightTexture:SetAllPoints(cButton)
+			highlightTexture:SetBlendMode('ADD')
+			cButton:SetHighlightTexture(highlightTexture)

-					  -- Disable the search button since we're not searching for anything now
-					  ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall")
-					  ARL_SearchButton:Disable()
+			local checkedTexture = cButton:CreateTexture()
+			checkedTexture:SetTexture('Interface/Buttons/CheckButtonHilight')
+			checkedTexture:SetAllPoints(cButton)
+			checkedTexture:SetBlendMode('ADD')
+			cButton:SetCheckedTexture(checkedTexture)

-					  -- Make sure to clear text for last search
-					  ARL_LastSearchedText = ""
+			-- Create the text object to go along with it
+			local cbText = cButton:CreateFontString("cbText", "OVERLAY", "GameFontHighlight")
+			cbText:SetText(addon:Yellow(ExpButtonText[panelIndex]))
+			cbText:SetPoint("LEFT", cButton, "RIGHT", 5, 0)
+			cbText:SetHeight(14)
+			cbText:SetWidth(100)
+			cbText:SetJustifyH("LEFT")
+			cButton.text = cbText

-					  MainPanel.scroll_frame:Update(false, false)
-				  end)
+			-- And throw up a tooltip
+			SetTooltipScripts(cButton, ExpButtonTT[panelIndex])
+			cButton:Hide()
+		end
+		return cButton
+	end
+end	-- do

-	ARL_SearchText = CreateFrame("EditBox", "ARL_SearchText", MainPanel, "InputBoxTemplate")
-	ARL_SearchText:SetText(L["SEARCH_BOX_DESC"])
-	ARL_SearchText:SetScript("OnEnterPressed",
-				 function(this)
-					 local searchtext = ARL_SearchText:GetText()
-					 searchtext = searchtext:trim()
-					 if (searchtext ~= "") and (searchtext ~= L["SEARCH_BOX_DESC"]) then
-						 ARL_LastSearchedText = searchtext
+local function SetSortName()
+	local sort_type = addon.db.profile.sorting

-						 SearchRecipes(searchtext)
-						 MainPanel.scroll_frame:Update(false, false)
+	if sort_type == "Name" then
+		ARL_DD_SortText:SetText(L["Sort"] .. ": " .. _G.NAME)
+	elseif sort_type == "SkillAsc" then
+		ARL_DD_SortText:SetText(L["Sort"] .. ": " .. L["Skill (Asc)"])
+	elseif sort_type == "SkillDesc" then
+		ARL_DD_SortText:SetText(L["Sort"] .. ": " .. L["Skill (Desc)"])
+	elseif sort_type == "Acquisition" then
+		ARL_DD_SortText:SetText(L["Sort"] .. ": " .. L["Acquisition"])
+	elseif sort_type == "Location" then
+		ARL_DD_SortText:SetText(L["Sort"] .. ": " .. L["Location"])
+	end

-						 ARL_ExpandButton:SetText(L["EXPANDALL"])
-						 SetTooltipScripts(ARL_ExpandButton, L["EXPANDALL_DESC"])
+end

-						 ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall")
-						 ARL_SearchButton:Disable()
-					 end
-				 end)
-	ARL_SearchText:SetScript("OnEditFocusGained",
-				 function(this)
-					 if this:GetText() == L["SEARCH_BOX_DESC"] then
-						 this:SetText("")
-					 end
-				 end)
-	ARL_SearchText:SetScript("OnEditFocusLost",
-				 function(this)
-					 if this:GetText() == "" then
-						 this:SetText(L["SEARCH_BOX_DESC"])
-					 end
-				 end)
-	ARL_SearchText:SetScript("OnTextChanged",
-				 function(this)
-					 if (this:GetText() ~= "" and this:GetText() ~= L["SEARCH_BOX_DESC"] and this:GetText() ~= ARL_LastSearchedText) then
-						 ARL_SearchButton:SetNormalFontObject("GameFontNormalSmall")
-						 ARL_SearchButton:Enable()
-					 else
-						 ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall")
-						 ARL_SearchButton:Disable()
-					 end
-				 end)
-	ARL_SearchText:EnableMouse(true)
-	ARL_SearchText:SetAutoFocus(false)
-	ARL_SearchText:SetFontObject(ChatFontNormal)
-	ARL_SearchText:SetWidth(130)
-	ARL_SearchText:SetHeight(12)
-	ARL_SearchText:SetPoint("RIGHT", ARL_ClearButton, "LEFT", 3, -1)
-	ARL_SearchText:Show()
+local function ARL_DD_Sort_OnClick(button, value)
+	CloseDropDownMenus()
+	addon.db.profile.sorting = value
+	SetSortName()
+	ReDisplay()
+end

-	local ARL_CloseButton = GenericCreateButton("ARL_CloseButton", MainPanel, 22, 69, "GameFontNormalSmall", "GameFontHighlightSmall", L["Close"], "CENTER",
-						    L["CLOSE_DESC"], 1)
-	ARL_CloseButton:SetPoint("BOTTOMRIGHT", MainPanel, "BOTTOMRIGHT", -4, 3)
+local function ARL_DD_Sort_Initialize()
+	local info = UIDropDownMenu_CreateInfo()

-	ARL_CloseButton:SetScript("OnClick",
-				  function(self)
-					  MainPanel:Hide()
-				  end)
+	local k = "Name"
+	info.text = k
+	info.arg1 = info.text
+	info.func = ARL_DD_Sort_OnClick
+	info.checked = (addon.db.profile.sorting == k)
+	UIDropDownMenu_AddButton(info)

-	-------------------------------------------------------------------------------
-	-- Set the scripts for MainPanel.scroll_frame's buttons.
-	-------------------------------------------------------------------------------
-	do
-		local function RecipeItem_OnClick(self, button)
-			local clickedIndex = self.string_index
+	k = "SkillAsc"
+	info.text = k
+	info.arg1 = info.text
+	info.func = ARL_DD_Sort_OnClick
+	info.checked = (addon.db.profile.sorting == k)
+	UIDropDownMenu_AddButton(info)

-			-- Don't do anything if they've clicked on an empty button
-			if not clickedIndex or clickedIndex == 0 then
-				return
-			end
-			local clicked_line = MainPanel.scroll_frame.entries[clickedIndex]
-			local traverseIndex = 0
+	k = "SkillDesc"
+	info.text = k
+	info.arg1 = info.text
+	info.func = ARL_DD_Sort_OnClick
+	info.checked = (addon.db.profile.sorting == k)
+	UIDropDownMenu_AddButton(info)

-			-- First, check if this is a "modified" click, and react appropriately
-			if IsModifierKeyDown() then
-				if IsControlKeyDown() and IsShiftKeyDown() then
-					addon:SetupMap(clicked_line.recipe_id)
-				elseif IsShiftKeyDown() then
-					local itemID = addon.recipe_list[clicked_line.recipe_id]["ItemID"]
+	k = "Acquisition"
+	info.text = k
+	info.arg1 = info.text
+	info.func = ARL_DD_Sort_OnClick
+	info.checked = (addon.db.profile.sorting == k)
+	UIDropDownMenu_AddButton(info)

-					if itemID then
-						local _, itemLink = GetItemInfo(itemID)
+	k = "Location"
+	info.text = k
+	info.arg1 = info.text
+	info.func = ARL_DD_Sort_OnClick
+	info.checked = (addon.db.profile.sorting == k)
+	UIDropDownMenu_AddButton(info)

-						if itemLink then
-							ChatFrameEditBox:Insert(itemLink)
-						else
-							addon:Print(L["NoItemLink"])
-						end
-					else
-						addon:Print(L["NoItemLink"])
-					end
-				elseif IsControlKeyDown() then
-					ChatFrameEditBox:Insert(addon.recipe_list[clicked_line.recipe_id]["RecipeLink"])
-				elseif IsAltKeyDown() then
-					-- Code needed here to insert this item into the "Ignore List"
-					addon:ToggleExcludeRecipe(clicked_line.recipe_id)
-					ReDisplay()
-				end
-			elseif clicked_line.is_header then
-				-- three possibilities here (all with no modifiers)
-				-- 1) We clicked on the recipe button on a closed recipe
-				-- 2) We clicked on the recipe button of an open recipe
-				-- 3) we clicked on the expanded text of an open recipe
-				if clicked_line.is_expanded then
-					traverseIndex = clickedIndex + 1
+	SetSortName()
+end
+
+-------------------------------------------------------------------------------
+-- Data used in GenerateClickableTT() and its support functions.
+-------------------------------------------------------------------------------
+local click_info = {
+	anchor = nil,
+	change_realm = nil,
+	target_realm = nil,
+	modified = nil,
+	name = nil,
+	realm = nil,
+}
+local clicktip
+local GenerateClickableTT	-- Upvalued!
+
+-------------------------------------------------------------------------------
+-- Clicktip OnMouseUp scripts.
+-------------------------------------------------------------------------------
+local function ChangeRealm(cell, arg, button)
+	click_info.modified = true
+	click_info.realm = nil
+	click_info.change_realm = true
+	click_info.target_realm = nil
+	GenerateClickableTT()
+end
+
+local function SelectRealm(cell, arg, button)
+	click_info.modified = true
+
+	if click_info.change_realm then
+		click_info.target_realm = arg
+	end
+	click_info.realm = arg
+	GenerateClickableTT()
+end
+
+local function SelectName(cell, arg, button)
+	click_info.modified = true
+	click_info.name = arg
+
+	-- Wipe tradeskill information for the selected toon. -Torhal
+	if IsAltKeyDown() and button == "LeftButton" then
+		local tskl_list = addon.db.global.tradeskill
+		tskl_list[click_info.realm][click_info.name] = nil
+
+		-- See if there are any toons left on the realm. If not, nuke it as well.
+		local found = false
+		for name in pairs(tskl_list[click_info.realm]) do
+			found = true
+		end
+		if not found then
+			tskl_list[click_info.realm] = nil
+		end
+		local anchor = click_info.anchor
+		twipe(click_info)
+		click_info.anchor = anchor
+		GenerateClickableTT()
+		return
+	end
+	GenerateClickableTT()
+end

-					-- get rid of our expanded lines
-					while (MainPanel.scroll_frame.entries[traverseIndex] and not MainPanel.scroll_frame.entries[traverseIndex].is_header) do
-						ReleaseTable(tremove(MainPanel.scroll_frame.entries, traverseIndex))
+local function SelectProfession(cell, arg, button)
+	local tskl_list = addon.db.global.tradeskill
+	click_info.modified = true
+	addon:Print(click_info.name .. " - " .. click_info.realm .. ": " .. tskl_list[click_info.realm][click_info.name][arg])
+end

-						if not MainPanel.scroll_frame.entries[traverseIndex] then
-							break
-						end
-					end
-					clicked_line.is_expanded = false
-				else
-					MainPanel.scroll_frame:ExpandEntry(clickedIndex)
-					clicked_line.is_expanded = true
-				end
-			else
-				-- this inherently implies that we're on an expanded recipe
-				-- first, back up in the list of buttons until we find our recipe line
-				local entries = MainPanel.scroll_frame.entries
+-------------------------------------------------------------------------------
+-- Creates a list of names/alts/etc in a tooltip which can be clicked.
+-------------------------------------------------------------------------------
+function GenerateClickableTT(anchor)
+	local tskl_list = addon.db.global.tradeskill
+	local tip = clicktip
+	local y, x
+	local prealm = GetRealmName()
+	local target_realm = prealm

-				traverseIndex = clickedIndex - 1
+	if click_info.change_realm then
+		target_realm = click_info.target_realm
+		click_info.change_realm = nil
+	end
+	tip:Clear()

-				while entries[traverseIndex] and not entries[traverseIndex].is_header do
-					traverseIndex = traverseIndex - 1
-				end
-				entries[traverseIndex].is_expanded = false
-				traverseIndex = traverseIndex + 1
+	if not click_info.realm then
+		local other_realms = nil
+		local header = nil
+		for realm in pairs(tskl_list) do
+			if target_realm and (realm ~= target_realm) then
+				other_realms = true
+			end

-				-- now remove the expanded lines until we get to a recipe again
-				while entries[traverseIndex] and not entries[traverseIndex].is_header do
-					ReleaseTable(tremove(entries, traverseIndex))
+			if not target_realm and (realm ~= prealm) then
+				if not header then
+					tip:AddHeader(L["Other Realms"])
+					tip:AddSeparator()
+					header = true
+				end
+				y, x = tip:AddLine()
+				tip:SetCell(y, x, realm)
+				tip:SetCellScript(y, x, "OnMouseUp", SelectRealm, realm)
+			elseif realm == target_realm then
+				tip:AddHeader(realm)
+				tip:AddSeparator()

-					if not entries[traverseIndex] then
-						break
+				click_info.realm = realm
+				for name in pairs(tskl_list[click_info.realm]) do
+					if name ~= UnitName("player") then
+						y, x = tip:AddLine()
+						tip:SetCell(y, x, name)
+						tip:SetCellScript(y, x, "OnMouseUp", SelectName, name)
 					end
 				end
 			end
-			MainPanel.scroll_frame:Update(false, true)
 		end
+		if other_realms then
+			tip:AddSeparator()
+			y, x = tip:AddLine()
+			tip:SetCell(y, x, L["Other Realms"])
+			tip:SetCellScript(y, x, "OnMouseUp", ChangeRealm)
+		end
+		tip:AddSeparator()
+	elseif not click_info.name then
+		local realm_list = tskl_list[click_info.realm]

-		for i = 1, NUM_RECIPE_LINES do
-			local temp_state = GenericCreateButton("ARL_StateButton" .. i, MainPanel.scroll_frame, 16, 16, "GameFontNormalSmall", "GameFontHighlightSmall",
-							       "", "LEFT", "", 2)
-
-			local temp_recipe = GenericCreateButton("ARL_RecipeButton" .. i, MainPanel.scroll_frame, 16, 224, "GameFontNormalSmall", "GameFontHighlightSmall",
-								"Blort", "LEFT", "", 0)
-
-			if i ~= 1 then
-				temp_state:SetPoint("TOPLEFT", MainPanel.scroll_frame.state_buttons[i - 1], "BOTTOMLEFT", 0, 3)
-				temp_recipe:SetPoint("TOPLEFT", MainPanel.scroll_frame.recipe_buttons[i - 1], "BOTTOMLEFT", 0, 3)
-			else
-				temp_state:SetPoint("TOPLEFT", MainPanel, "TOPLEFT", 20, -100)
-				temp_recipe:SetPoint("TOPLEFT", MainPanel, "TOPLEFT", 37, -100)
+		if realm_list then
+			tip:AddLine(click_info.realm)
+			tip:AddSeparator()
+			for name in pairs(realm_list) do
+				y, x = tip:AddLine()
+				tip:SetCell(y, x, name)
+				tip:SetCellScript(y, x, "OnMouseUp", SelectName, name)
 			end
-			temp_state:SetScript("OnClick", RecipeItem_OnClick)
-			temp_recipe:SetScript("OnClick", RecipeItem_OnClick)
-
-			MainPanel.scroll_frame.state_buttons[i] = temp_state
-			MainPanel.scroll_frame.recipe_buttons[i] = temp_recipe
+			tip:AddSeparator()
 		end
-	end	-- do
+	else
+		tip:AddHeader(click_info.name)
+		tip:AddSeparator()
+		for prof in pairs(tskl_list[click_info.realm][click_info.name]) do
+			y, x = tip:AddLine()
+			tip:SetCell(y, x, prof)
+			tip:SetCellScript(y, x, "OnMouseUp", SelectProfession, prof)
+		end
+		tip:AddSeparator()
+	end
+	if anchor then
+		click_info.anchor = anchor
+		tip:SetPoint("TOP", anchor, "BOTTOM")
+	else
+		tip:SetPoint("TOP", click_info.anchor, "BOTTOM")
+	end
+	tip:Show()
+end

+-------------------------------------------------------------------------------
+-- Creates the initial frame to display recipes into.
+-------------------------------------------------------------------------------
+function addon:InitializeFrame()
 	-------------------------------------------------------------------------------
-	-- EXPANDED : 7 buttons for opening/closing the filter menu
+	-- Check to see if we're Horde or Alliance, and change the displayed
+	-- reputation strings to be faction-correct.
 	-------------------------------------------------------------------------------
-	ARL_ExpGeneralOptCB = CreateFilterMenuButton("ARL_ExpGeneralOptCB", "INV_Misc_Note_06", 1)
-	ARL_ExpGeneralOptCB:SetPoint("TOPRIGHT", MainPanel.filter_toggle, "BOTTOMLEFT", -1, -50)
-
-	ARL_ExpObtainOptCB = CreateFilterMenuButton("ARL_ExpObtainOptCB", "Spell_Shadow_MindRot", 2)
-	ARL_ExpObtainOptCB:SetPoint("TOPLEFT", ARL_ExpGeneralOptCB, "BOTTOMLEFT", 0, -8)
-
-	ARL_ExpBindingOptCB = CreateFilterMenuButton("ARL_ExpBindingOptCB", "INV_Belt_20", 3)
-	ARL_ExpBindingOptCB:SetPoint("TOPLEFT", ARL_ExpObtainOptCB, "BOTTOMLEFT", -0, -8)
-
-	ARL_ExpItemOptCB = CreateFilterMenuButton("ARL_ExpItemOptCB", "INV_Misc_EngGizmos_19", 4)
-	ARL_ExpItemOptCB:SetPoint("TOPLEFT", ARL_ExpBindingOptCB, "BOTTOMLEFT", -0, -8)
-
-	ARL_ExpPlayerOptCB = CreateFilterMenuButton("ARL_ExpPlayerOptCB", "INV_Misc_GroupLooking", 5)
-	ARL_ExpPlayerOptCB:SetPoint("TOPLEFT", ARL_ExpItemOptCB, "BOTTOMLEFT", -0, -8)
-
-	ARL_ExpRepOptCB = CreateFilterMenuButton("ARL_ExpRepOptCB", "INV_Scroll_05", 6)
-	ARL_ExpRepOptCB:SetPoint("TOPLEFT", ARL_ExpPlayerOptCB, "BOTTOMLEFT", -0, -8)
+	local isAlliance = (Player["Faction"] == "Alliance")

-	ARL_ExpMiscOptCB = CreateFilterMenuButton("ARL_ExpMiscOptCB", "Trade_Engineering", 7)
-	ARL_ExpMiscOptCB:SetPoint("TOPLEFT", ARL_ExpRepOptCB, "BOTTOMLEFT", -0, -8)
+	local HonorHold_Thrallmar_FactionText = isAlliance and BFAC["Honor Hold"] or BFAC["Thrallmar"]
+	local Kurenai_Maghar_FactionText = isAlliance and BFAC["Kurenai"] or BFAC["The Mag'har"]
+	local Vanguard_Expedition_FactionText = isAlliance and BFAC["Alliance Vanguard"] or BFAC["Horde Expedition"]
+	local SilverConv_Sunreaver_FactionText = isAlliance and BFAC["The Silver Covenant"] or BFAC["The Sunreavers"]
+	local Valiance_Warsong_FactionText = isAlliance and BFAC["Valiance Expedition"] or BFAC["Warsong Offensive"]
+	local Frostborn_Taunka_FactionText = isAlliance and BFAC["The Frostborn"] or BFAC["The Taunka"]
+	local Explorer_Hand_FactionText = isAlliance and BFAC["Explorers' League"] or BFAC["The Hand of Vengeance"]

 	-------------------------------------------------------------------------------
-	-- Flyaway virtual frames to group buttons/text easily (and make them easy to show/hide)
+	-- Create the sort-type DropDown.
 	-------------------------------------------------------------------------------
-	MainPanel.filter_menu.General = CreateFrame("Frame", "ARL_FilterMenu_General", MainPanel.filter_menu)
-	MainPanel.filter_menu.General:SetWidth(FILTERMENU_SMALL)
-	MainPanel.filter_menu.General:SetHeight(280)
-	MainPanel.filter_menu.General:EnableMouse(true)
-	MainPanel.filter_menu.General:EnableKeyboard(true)
-	MainPanel.filter_menu.General:SetMovable(false)
-	MainPanel.filter_menu.General:SetPoint("TOPLEFT", MainPanel.filter_menu, "TOPLEFT", 17, -16)
-	MainPanel.filter_menu.General:Hide()
-
+	local ARL_DD_Sort = CreateFrame("Frame", "ARL_DD_Sort", MainPanel, "UIDropDownMenuTemplate")
+	ARL_DD_Sort:SetPoint("TOPLEFT", MainPanel, "TOPLEFT", 55, -39)
+	ARL_DD_Sort:SetHitRectInsets(16, 16, 0, 0)
+	SetSortName()
+	UIDropDownMenu_SetWidth(ARL_DD_Sort, 105)

 	-------------------------------------------------------------------------------
-	--			() Craft Specialty recipes
-	--			() All skill levels
-	--			() Cross-Faction
-	--			() Known
-	--			() Unknown
-	--			Classes:
-	--			() Deathknight
-	--			() Druid
-	--			() Hunter
-	--			() Mage
-	--			() Paladin
-	--			() Priest
-	--			() Rogue
-	--			() Shaman
-	--			() Warlock
-	--			() Warrior
-	-------------------------------------------------------------------------------
-	local ARL_SpecialtyCB = CreateFrame("CheckButton", "ARL_SpecialtyCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_SpecialtyCB, MainPanel.filter_menu.General, L["SPECIALTY_DESC"], "specialty", 1, 1, 0)
-	ARL_SpecialtyCBText:SetText(L["Specialties"])
-
-	local ARL_LevelCB = CreateFrame("CheckButton", "ARL_LevelCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_LevelCB, MainPanel.filter_menu.General, L["SKILL_DESC"], "skill", 2, 1, 0)
-	ARL_LevelCBText:SetText(_G.SKILL)
-
-	local ARL_FactionCB = CreateFrame("CheckButton", "ARL_FactionCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_FactionCB, MainPanel.filter_menu.General, L["FACTION_DESC"], "faction", 3, 1, 0)
-	ARL_FactionCBText:SetText(_G.FACTION)
-
-	local ARL_KnownCB = CreateFrame("CheckButton", "ARL_KnownCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_KnownCB, MainPanel.filter_menu.General, L["KNOWN_DESC"], "known", 4, 1, 0)
-	ARL_KnownCBText:SetText(L["Show Known"])
-
-	local ARL_UnknownCB = CreateFrame("CheckButton", "ARL_UnknownCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_UnknownCB, MainPanel.filter_menu.General, L["UNKNOWN_DESC"], "unknown", 5, 1, 0)
-	ARL_UnknownCBText:SetText(L["Show Unknown"])
-
-	local ARL_ClassButton = GenericCreateButton("ARL_ClassButton", MainPanel.filter_menu.General, 20, 105, "GameFontHighlight", "GameFontHighlightSmall",
-						    L["Classes"] .. ":", "LEFT", L["CLASS_TEXT_DESC"], 0)
-	ARL_ClassButton:SetPoint("TOPLEFT", ARL_UnknownCB, "BOTTOMLEFT", -4, 6)
-
-	ARL_ClassButton:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight")
-	ARL_ClassButton:RegisterForClicks("LeftButtonUp", "RightButtonUp")
-	ARL_ClassButton:SetScript("OnClick",
-				  function(self, button)
-					  local filterdb = addon.db.profile.filters
-
-					  if button == "LeftButton" then
-						  for class in pairs(filterdb.classes) do
-							  filterdb.classes[class] = true
-						  end
-					  elseif button == "RightButton" then
-						  for class in pairs(filterdb.classes) do
-							  filterdb.classes[class] = false
-						  end
-						  -- Set your own class to true
-						  filterdb.classes[strlower(Player["Class"])] = true
-					  end
-
-					  -- Update the checkboxes with the new value
-					  ARL_DeathKnightCB:SetChecked(filterdb.classes.deathknight)
-					  ARL_DruidCB:SetChecked(filterdb.classes.druid)
-					  ARL_HunterCB:SetChecked(filterdb.classes.hunter)
-					  ARL_MageCB:SetChecked(filterdb.classes.mage)
-					  ARL_PaladinCB:SetChecked(filterdb.classes.paladin)
-					  ARL_PriestCB:SetChecked(filterdb.classes.priest)
-					  ARL_RogueCB:SetChecked(filterdb.classes.rogue)
-					  ARL_ShamanCB:SetChecked(filterdb.classes.shaman)
-					  ARL_WarlockCB:SetChecked(filterdb.classes.warlock)
-					  ARL_WarriorCB:SetChecked(filterdb.classes.warrior)
-					  -- Reset our title
-					  MainPanel:UpdateTitle()
-					  -- Use new filters
-					  ReDisplay()
-				  end)
-
-	-- Get the localized class names
-	local BCM = LOCALIZED_CLASS_NAMES_MALE
-	--local BCF = LOCALIZED_CLASS_NAMES_FEMALE
+	-- Create the expand button and set its scripts.
+	-------------------------------------------------------------------------------
+	local ARL_ExpandButton = GenericCreateButton("ARL_ExpandButton", MainPanel, 21, 40, "GameFontNormalSmall", "GameFontHighlightSmall", L["EXPANDALL"], "CENTER",
+						     L["EXPANDALL_DESC"], 1)
+	ARL_ExpandButton:SetPoint("TOPRIGHT", ARL_DD_Sort, "BOTTOMLEFT", -2, 0)

-	local ARL_DeathKnightCB = CreateFrame("CheckButton", "ARL_DeathKnightCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_DeathKnightCB, MainPanel.filter_menu.General, L["CLASS_DESC"], "deathknight", 7, 1, 0)
-	ARL_DeathKnightCBText:SetText(BCM["DEATHKNIGHT"])
+	ARL_ExpandButton:SetScript("OnClick",
+				   function(self, mouse_button, down)
+					   local expand_acquires = (self:GetText() == L["EXPANDALL"])

-	local ARL_DruidCB = CreateFrame("CheckButton", "ARL_DruidCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_DruidCB, MainPanel.filter_menu.General, L["CLASS_DESC"], "druid", 8, 1, 0)
-	ARL_DruidCBText:SetText(BCM["DRUID"])
+					   if expand_acquires then
+						   self:SetText(L["CONTRACTALL"])
+						   SetTooltipScripts(self, L["CONTRACTALL_DESC"])
+					   else
+						   self:SetText(L["EXPANDALL"])
+						   SetTooltipScripts(self, L["EXPANDALL_DESC"])
+					   end
+					   MainPanel.scroll_frame:Update(expand_acquires, false)
+				   end)
+	ARL_ExpandButton:SetText(L["EXPANDALL"])
+	SetTooltipScripts(ARL_ExpandButton, L["EXPANDALL_DESC"])

-	local ARL_HunterCB = CreateFrame("CheckButton", "ARL_HunterCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_HunterCB, MainPanel.filter_menu.General, L["CLASS_DESC"], "hunter", 9, 1, 0)
-	ARL_HunterCBText:SetText(BCM["HUNTER"])
+	-------------------------------------------------------------------------------
+	-- The search button, clear button, and search entry box.
+	-------------------------------------------------------------------------------
+	local SearchRecipes
+	do
+		local search_params = {
+			["ItemID"]	= true,
+			["Name"]	= true,
+			["Locations"]	= true,
+			["Specialty"]	= true,
+			["Level"]	= true,
+			["Rarity"]	= true,
+		}
+		-- Scans through the recipe database and toggles the flag on if the item is in the search criteria
+		function SearchRecipes(pattern)
+			if not pattern then
+				return
+			end
+			pattern = pattern:lower()

-	local ARL_MageCB = CreateFrame("CheckButton", "ARL_MageCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_MageCB, MainPanel.filter_menu.General, L["CLASS_DESC"], "mage", 10, 1, 0)
-	ARL_MageCBText:SetText(BCM["MAGE"])
+			local recipe_list = addon.recipe_list

-	local ARL_PaladinCB = CreateFrame("CheckButton", "ARL_PaladinCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_PaladinCB, MainPanel.filter_menu.General, L["CLASS_DESC"], "paladin", 11, 1, 0)
-	ARL_PaladinCBText:SetText(BCM["PALADIN"])
+			for index in pairs(recipe_list) do
+				local entry = recipe_list[index]
+				entry["Search"] = false

-	local ARL_PriestCB = CreateFrame("CheckButton", "ARL_PriestCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_PriestCB, MainPanel.filter_menu.General, L["CLASS_DESC"], "priest", 12, 1, 0)
-	ARL_PriestCBText:SetText(BCM["PRIEST"])
+				for field in pairs(search_params) do
+					local str = entry[field] and tostring(entry[field]):lower() or nil

-	local ARL_RogueCB = CreateFrame("CheckButton", "ARL_RogueCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RogueCB, MainPanel.filter_menu.General, L["CLASS_DESC"], "rogue", 13, 1, 0)
-	ARL_RogueCBText:SetText(BCM["ROGUE"])
+					if str and str:find(pattern) then
+						entry["Search"] = true
+						break
+					end
+				end
+			end
+		end
+	end	-- do

-	local ARL_ShamanCB = CreateFrame("CheckButton", "ARL_ShamanCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_ShamanCB, MainPanel.filter_menu.General, L["CLASS_DESC"], "shaman", 14, 1, 0)
-	ARL_ShamanCBText:SetText(BCM["SHAMAN"])
+	local ARL_SearchButton = GenericCreateButton("ARL_SearchButton", MainPanel, 25, 74, "GameFontDisableSmall", "GameFontHighlightSmall", _G.SEARCH, "CENTER",
+						     L["SEARCH_DESC"], 1)
+	ARL_SearchButton:SetPoint("TOPLEFT", ARL_DD_Sort, "BOTTOMRIGHT", 1, 4)

-	local ARL_WarlockCB = CreateFrame("CheckButton", "ARL_WarlockCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_WarlockCB, MainPanel.filter_menu.General, L["CLASS_DESC"], "warlock", 15, 1, 0)
-	ARL_WarlockCBText:SetText(BCM["WARLOCK"])
+	ARL_SearchButton:Disable()
+	ARL_SearchButton:SetScript("OnClick",
+				   function(this)
+					   local searchtext = ARL_SearchText:GetText()
+					   searchtext = searchtext:trim()

-	local ARL_WarriorCB = CreateFrame("CheckButton", "ARL_WarriorCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_WarriorCB, MainPanel.filter_menu.General, L["CLASS_DESC"], "warrior", 16, 1, 0)
-	ARL_WarriorCBText:SetText(BCM["WARRIOR"])
+					   if (searchtext ~= "") then
+						   ARL_LastSearchedText = searchtext

-	MainPanel.filter_menu.Obtain = CreateFrame("Frame", "ARL_FilterMenu_Obtain", MainPanel.filter_menu)
-	MainPanel.filter_menu.Obtain:SetWidth(FILTERMENU_SMALL)
-	MainPanel.filter_menu.Obtain:SetHeight(280)
-	MainPanel.filter_menu.Obtain:EnableMouse(true)
-	MainPanel.filter_menu.Obtain:EnableKeyboard(true)
-	MainPanel.filter_menu.Obtain:SetMovable(false)
-	MainPanel.filter_menu.Obtain:SetPoint("TOPLEFT", MainPanel.filter_menu, "TOPLEFT", 17, -16)
-	MainPanel.filter_menu.Obtain:Hide()
+						   SearchRecipes(searchtext)
+						   MainPanel.scroll_frame:Update(false, false)

-	-------------------------------------------------------------------------------
-	--			() Instance	() Raid
-	--			() Quest	() Seasonal
-	--			() Trainer	() Vendor
-	--			() PVP		() Discovery
-	--			() World Drop	() Mob Drop
-	-------------------------------------------------------------------------------
-	local ARL_InstanceCB = CreateFrame("CheckButton", "ARL_InstanceCB", MainPanel.filter_menu.Obtain, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_InstanceCB, MainPanel.filter_menu.Obtain, L["INSTANCE_DESC"], "instance", 1, 1, 0)
-	ARL_InstanceCBText:SetText(_G.INSTANCE)
+						   ARL_ExpandButton:SetText(L["EXPANDALL"])
+						   SetTooltipScripts(ARL_ExpandButton, L["EXPANDALL_DESC"])

-	local ARL_RaidCB = CreateFrame("CheckButton", "ARL_RaidCB", MainPanel.filter_menu.Obtain, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RaidCB, MainPanel.filter_menu.Obtain, L["RAID_DESC"], "raid", 2, 1, 0)
-	ARL_RaidCBText:SetText(_G.RAID)
+						   ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall")
+						   ARL_SearchButton:Disable()
+					   end
+				   end)

-	local ARL_QuestCB = CreateFrame("CheckButton", "ARL_QuestCB", MainPanel.filter_menu.Obtain, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_QuestCB, MainPanel.filter_menu.Obtain, L["QUEST_DESC"], "quest", 3, 1, 0)
-	ARL_QuestCBText:SetText(L["Quest"])
+	local ARL_ClearButton = GenericCreateButton("ARL_ClearButton", MainPanel, 28, 28, "GameFontNormalSmall", "GameFontHighlightSmall", "", "CENTER", L["CLEAR_DESC"], 3)
+	ARL_ClearButton:SetPoint("RIGHT", ARL_SearchButton, "LEFT", 4, -1)

-	local ARL_SeasonalCB = CreateFrame("CheckButton", "ARL_SeasonalCB", MainPanel.filter_menu.Obtain, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_SeasonalCB, MainPanel.filter_menu.Obtain, L["SEASONAL_DESC"], "seasonal", 4, 1, 0)
-	ARL_SeasonalCBText:SetText(SEASONAL_CATEGORY)
+	ARL_ClearButton:SetScript("OnClick",
+				  function()
+					  local recipe_list = addon.recipe_list

-	local ARL_TrainerCB = CreateFrame("CheckButton", "ARL_TrainerCB", MainPanel.filter_menu.Obtain, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_TrainerCB, MainPanel.filter_menu.Obtain, L["TRAINER_DESC"], "trainer", 5, 1, 0)
-	ARL_TrainerCBText:SetText(L["Trainer"])
+					  -- Reset the search flags
+					  for index in pairs(recipe_list) do
+						  recipe_list[index]["Search"] = true
+					  end
+					  ARL_SearchText:SetText(L["SEARCH_BOX_DESC"])

-	local ARL_VendorCB = CreateFrame("CheckButton", "ARL_VendorCB", MainPanel.filter_menu.Obtain, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_VendorCB, MainPanel.filter_menu.Obtain, L["VENDOR_DESC"], "vendor", 6, 1, 0)
-	ARL_VendorCBText:SetText(L["Vendor"])
+					  -- Make sure our expand all button is set to expandall
+					  ARL_ExpandButton:SetText(L["EXPANDALL"])
+					  SetTooltipScripts(ARL_ExpandButton, L["EXPANDALL_DESC"])

-	local ARL_PVPCB = CreateFrame("CheckButton", "ARL_PVPCB", MainPanel.filter_menu.Obtain, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_PVPCB, MainPanel.filter_menu.Obtain, L["PVP_DESC"], "pvp", 7, 1, 0)
-	ARL_PVPCBText:SetText(_G.PVP)
+					  -- Make sure to clear the focus of the searchbox
+					  ARL_SearchText:ClearFocus()

-	local ARL_DiscoveryCB = CreateFrame("CheckButton", "ARL_DiscoveryCB", MainPanel.filter_menu.Obtain, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_DiscoveryCB, MainPanel.filter_menu.Obtain, L["DISCOVERY_DESC"], "discovery", 8, 1, 0)
-	ARL_DiscoveryCBText:SetText(L["Discovery"])
+					  -- Disable the search button since we're not searching for anything now
+					  ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall")
+					  ARL_SearchButton:Disable()

-	local ARL_WorldDropCB = CreateFrame("CheckButton", "ARL_WorldDropCB", MainPanel.filter_menu.Obtain, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_WorldDropCB, MainPanel.filter_menu.Obtain, L["WORLD_DROP_DESC"], "worlddrop", 9, 1, 0)
-	ARL_WorldDropCBText:SetText(L["World Drop"])
+					  -- Make sure to clear text for last search
+					  ARL_LastSearchedText = ""

-	local ARL_MobDropCB = CreateFrame("CheckButton", "ARL_MobDropCB", MainPanel.filter_menu.Obtain, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_MobDropCB, MainPanel.filter_menu.Obtain, L["MOB_DROP_DESC"], "mobdrop", 10, 1, 0)
-	ARL_MobDropCBText:SetText(L["Mob Drop"])
+					  MainPanel.scroll_frame:Update(false, false)
+				  end)

-	local ARL_OriginalWoWCB = CreateFrame("CheckButton", "ARL_OriginalWoWCB", MainPanel.filter_menu.Obtain, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_OriginalWoWCB, MainPanel.filter_menu.Obtain, L["ORIGINAL_WOW_DESC"], "originalwow", 12, 1, 0)
-	ARL_OriginalWoWCBText:SetText(_G.EXPANSION_NAME0)
+	ARL_SearchText = CreateFrame("EditBox", "ARL_SearchText", MainPanel, "InputBoxTemplate")
+	ARL_SearchText:SetText(L["SEARCH_BOX_DESC"])
+	ARL_SearchText:SetScript("OnEnterPressed",
+				 function(this)
+					 local searchtext = ARL_SearchText:GetText()
+					 searchtext = searchtext:trim()
+					 if (searchtext ~= "") and (searchtext ~= L["SEARCH_BOX_DESC"]) then
+						 ARL_LastSearchedText = searchtext

-	local ARL_BCCB = CreateFrame("CheckButton", "ARL_BCCB", MainPanel.filter_menu.Obtain, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_BCCB, MainPanel.filter_menu.Obtain, L["BC_WOW_DESC"], "bc", 13, 1, 0)
-	ARL_BCCBText:SetText(_G.EXPANSION_NAME1)
+						 SearchRecipes(searchtext)
+						 MainPanel.scroll_frame:Update(false, false)

-	local ARL_WrathCB = CreateFrame("CheckButton", "ARL_WrathCB", MainPanel.filter_menu.Obtain, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_WrathCB, MainPanel.filter_menu.Obtain, L["LK_WOW_DESC"], "wrath", 14, 1, 0)
-	ARL_WrathCBText:SetText(_G.EXPANSION_NAME2)
+						 ARL_ExpandButton:SetText(L["EXPANDALL"])
+						 SetTooltipScripts(ARL_ExpandButton, L["EXPANDALL_DESC"])

-	MainPanel.filter_menu.Binding = CreateFrame("Frame", "ARL_FilterMenu_Binding", MainPanel.filter_menu)
-	MainPanel.filter_menu.Binding:SetWidth(FILTERMENU_LARGE)
-	MainPanel.filter_menu.Binding:SetHeight(280)
-	MainPanel.filter_menu.Binding:EnableMouse(true)
-	MainPanel.filter_menu.Binding:EnableKeyboard(true)
-	MainPanel.filter_menu.Binding:SetMovable(false)
-	MainPanel.filter_menu.Binding:SetPoint("TOPLEFT", MainPanel.filter_menu, "TOPLEFT", 17, -16)
-	MainPanel.filter_menu.Binding:Hide()
+						 ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall")
+						 ARL_SearchButton:Disable()
+					 end
+				 end)
+	ARL_SearchText:SetScript("OnEditFocusGained",
+				 function(this)
+					 if this:GetText() == L["SEARCH_BOX_DESC"] then
+						 this:SetText("")
+					 end
+				 end)
+	ARL_SearchText:SetScript("OnEditFocusLost",
+				 function(this)
+					 if this:GetText() == "" then
+						 this:SetText(L["SEARCH_BOX_DESC"])
+					 end
+				 end)
+	ARL_SearchText:SetScript("OnTextChanged",
+				 function(this)
+					 if (this:GetText() ~= "" and this:GetText() ~= L["SEARCH_BOX_DESC"] and this:GetText() ~= ARL_LastSearchedText) then
+						 ARL_SearchButton:SetNormalFontObject("GameFontNormalSmall")
+						 ARL_SearchButton:Enable()
+					 else
+						 ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall")
+						 ARL_SearchButton:Disable()
+					 end
+				 end)
+	ARL_SearchText:EnableMouse(true)
+	ARL_SearchText:SetAutoFocus(false)
+	ARL_SearchText:SetFontObject(ChatFontNormal)
+	ARL_SearchText:SetWidth(130)
+	ARL_SearchText:SetHeight(12)
+	ARL_SearchText:SetPoint("RIGHT", ARL_ClearButton, "LEFT", 3, -1)
+	ARL_SearchText:Show()

 	-------------------------------------------------------------------------------
-	--			() Crafted Item is Bind on Equip
-	--			() Crafted Item is Bind on Pickup
-	--			() Recipe is Bind on Equip
-	--			() Recipe is Bind on Pickup
+	-- Set the scripts for MainPanel.scroll_frame's buttons.
 	-------------------------------------------------------------------------------
-	local ARL_iBoECB = CreateFrame("CheckButton", "ARL_iBoECB", MainPanel.filter_menu.Binding, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_iBoECB, MainPanel.filter_menu.Binding, L["BOE_DESC"], "itemboe", 1, 1, 0)
-	ARL_iBoECBText:SetText(L["BOEFilter"])
-
-	local ARL_iBoPCB = CreateFrame("CheckButton", "ARL_iBoPCB", MainPanel.filter_menu.Binding, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_iBoPCB, MainPanel.filter_menu.Binding, L["BOP_DESC"], "itembop", 2, 1, 0)
-	ARL_iBoPCBText:SetText(L["BOPFilter"])
-
-	local ARL_rBoECB = CreateFrame("CheckButton", "ARL_rBoECB", MainPanel.filter_menu.Binding, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_rBoECB, MainPanel.filter_menu.Binding, L["RECIPE_BOE_DESC"], "recipeboe", 3, 1, 0)
-	ARL_rBoECBText:SetText(L["RecipeBOEFilter"])
+	do
+		local function RecipeItem_OnClick(self, button)
+			local clickedIndex = self.string_index

-	local ARL_rBoPCB = CreateFrame("CheckButton", "ARL_rBoPCB", MainPanel.filter_menu.Binding, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_rBoPCB, MainPanel.filter_menu.Binding, L["RECIPE_BOP_DESC"], "recipebop", 4, 1, 0)
-	ARL_rBoPCBText:SetText(L["RecipeBOPFilter"])
+			-- Don't do anything if they've clicked on an empty button
+			if not clickedIndex or clickedIndex == 0 then
+				return
+			end
+			local clicked_line = MainPanel.scroll_frame.entries[clickedIndex]
+			local traverseIndex = 0

-	MainPanel.filter_menu.Item = CreateFrame("Frame", "ARL_FilterMenu_Item", MainPanel.filter_menu)
-	MainPanel.filter_menu.Item:SetWidth(FILTERMENU_LARGE)
-	MainPanel.filter_menu.Item:SetHeight(280)
-	MainPanel.filter_menu.Item:EnableMouse(true)
-	MainPanel.filter_menu.Item:EnableKeyboard(true)
-	MainPanel.filter_menu.Item:SetMovable(false)
-	MainPanel.filter_menu.Item:SetPoint("TOPLEFT", MainPanel.filter_menu, "TOPLEFT", 17, -16)
-	MainPanel.filter_menu.Item:Hide()
+			-- First, check if this is a "modified" click, and react appropriately
+			if IsModifierKeyDown() then
+				if IsControlKeyDown() and IsShiftKeyDown() then
+					addon:SetupMap(clicked_line.recipe_id)
+				elseif IsShiftKeyDown() then
+					local itemID = addon.recipe_list[clicked_line.recipe_id]["ItemID"]

-	-------------------------------------------------------------------------------
-	--			Armor:
-	--				() Cloth	() Leather
-	--				() Mail		() Plate
-	--				() Cloak	() Necklace
-	--				() Rings	() Trinkets
-	--				() Shield
-	-------------------------------------------------------------------------------
-	local ARL_ArmorButton = GenericCreateButton("ARL_ArmorButton", MainPanel.filter_menu.Item, 20, 105, "GameFontHighlight", "GameFontHighlightSmall", _G.ARMOR_COLON,
-						    "LEFT", L["ARMOR_TEXT_DESC"], 0)
-	ARL_ArmorButton:SetPoint("TOPLEFT", MainPanel.filter_menu.Item, "TOPLEFT", -2, -4)
+					if itemID then
+						local _, itemLink = GetItemInfo(itemID)

-	ARL_ArmorButton:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight")
-	ARL_ArmorButton:RegisterForClicks("LeftButtonUp", "RightButtonUp")
-	ARL_ArmorButton:SetScript("OnClick",
-				  function(self, button)
-					  local armordb = addon.db.profile.filters.item.armor
+						if itemLink then
+							ChatFrameEditBox:Insert(itemLink)
+						else
+							addon:Print(L["NoItemLink"])
+						end
+					else
+						addon:Print(L["NoItemLink"])
+					end
+				elseif IsControlKeyDown() then
+					ChatFrameEditBox:Insert(addon.recipe_list[clicked_line.recipe_id]["RecipeLink"])
+				elseif IsAltKeyDown() then
+					-- Code needed here to insert this item into the "Ignore List"
+					addon:ToggleExcludeRecipe(clicked_line.recipe_id)
+					ReDisplay()
+				end
+			elseif clicked_line.is_header then
+				-- three possibilities here (all with no modifiers)
+				-- 1) We clicked on the recipe button on a closed recipe
+				-- 2) We clicked on the recipe button of an open recipe
+				-- 3) we clicked on the expanded text of an open recipe
+				if clicked_line.is_expanded then
+					traverseIndex = clickedIndex + 1

-					  if button == "LeftButton" then
-						  -- Reset all armor to true
-						  for armor in pairs(armordb) do
-							  armordb[armor] = true
-						  end
-					  elseif button == "RightButton" then
-						  -- Reset all armor to false
-						  for armor in pairs(armordb) do
-							  armordb[armor] = false
-						  end
-					  end
-					  -- Update the checkboxes with the new value
-					  ARL_ArmorClothCB:SetChecked(armordb.cloth)
-					  ARL_ArmorLeatherCB:SetChecked(armordb.leather)
-					  ARL_ArmorMailCB:SetChecked(armordb.mail)
-					  ARL_ArmorPlateCB:SetChecked(armordb.plate)
-					  ARL_ArmorCloakCB:SetChecked(armordb.cloak)
-					  ARL_ArmorNecklaceCB:SetChecked(armordb.necklace)
-					  ARL_ArmorRingCB:SetChecked(armordb.ring)
-					  ARL_ArmorTrinketCB:SetChecked(armordb.trinket)
-					  ARL_ArmorShieldCB:SetChecked(armordb.shield)
-					  -- Reset our title
-					  MainPanel:UpdateTitle()
-					  -- Use new filters
-					  ReDisplay()
-				  end)
+					-- get rid of our expanded lines
+					while (MainPanel.scroll_frame.entries[traverseIndex] and not MainPanel.scroll_frame.entries[traverseIndex].is_header) do
+						ReleaseTable(tremove(MainPanel.scroll_frame.entries, traverseIndex))

-	local ARL_ArmorClothCB = CreateFrame("CheckButton", "ARL_ArmorClothCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_ArmorClothCB, MainPanel.filter_menu.Item, L["CLOTH_DESC"], "cloth", 2, 1, 0)
-	ARL_ArmorClothCBText:SetText(L["Cloth"])
+						if not MainPanel.scroll_frame.entries[traverseIndex] then
+							break
+						end
+					end
+					clicked_line.is_expanded = false
+				else
+					MainPanel.scroll_frame:ExpandEntry(clickedIndex)
+					clicked_line.is_expanded = true
+				end
+			else
+				-- this inherently implies that we're on an expanded recipe
+				-- first, back up in the list of buttons until we find our recipe line
+				local entries = MainPanel.scroll_frame.entries

-	local ARL_ArmorLeatherCB = CreateFrame("CheckButton", "ARL_ArmorLeatherCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_ArmorLeatherCB, MainPanel.filter_menu.Item, L["LEATHER_DESC"], "leather", 2, 2, 0)
-	ARL_ArmorLeatherCBText:SetText(L["Leather"])
+				traverseIndex = clickedIndex - 1

-	local ARL_ArmorMailCB = CreateFrame("CheckButton", "ARL_ArmorMailCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_ArmorMailCB, MainPanel.filter_menu.Item, L["MAIL_DESC"], "mail", 3, 1, 0)
-	ARL_ArmorMailCBText:SetText(L["Mail"])
+				while entries[traverseIndex] and not entries[traverseIndex].is_header do
+					traverseIndex = traverseIndex - 1
+				end
+				entries[traverseIndex].is_expanded = false
+				traverseIndex = traverseIndex + 1

-	local ARL_ArmorPlateCB = CreateFrame("CheckButton", "ARL_ArmorPlateCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_ArmorPlateCB, MainPanel.filter_menu.Item, L["PLATE_DESC"], "plate", 3, 2, 0)
-	ARL_ArmorPlateCBText:SetText(L["Plate"])
+				-- now remove the expanded lines until we get to a recipe again
+				while entries[traverseIndex] and not entries[traverseIndex].is_header do
+					ReleaseTable(tremove(entries, traverseIndex))

-	local ARL_ArmorCloakCB = CreateFrame("CheckButton", "ARL_ArmorCloakCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_ArmorCloakCB, MainPanel.filter_menu.Item, L["CLOAK_DESC"], "cloak", 4, 1, 0)
-	ARL_ArmorCloakCBText:SetText(L["Cloak"])
+					if not entries[traverseIndex] then
+						break
+					end
+				end
+			end
+			MainPanel.scroll_frame:Update(false, true)
+		end

-	local ARL_ArmorNecklaceCB = CreateFrame("CheckButton", "ARL_ArmorNecklaceCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_ArmorNecklaceCB, MainPanel.filter_menu.Item, L["NECKLACE_DESC"], "necklace", 4, 2, 0)
-	ARL_ArmorNecklaceCBText:SetText(L["Necklace"])
+		for i = 1, NUM_RECIPE_LINES do
+			local temp_state = GenericCreateButton("ARL_StateButton" .. i, MainPanel.scroll_frame, 16, 16, "GameFontNormalSmall", "GameFontHighlightSmall",
+							       "", "LEFT", "", 2)

-	local ARL_ArmorRingCB = CreateFrame("CheckButton", "ARL_ArmorRingCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_ArmorRingCB, MainPanel.filter_menu.Item, L["RING_DESC"], "ring", 5, 1, 0)
-	ARL_ArmorRingCBText:SetText(L["Ring"])
+			local temp_recipe = GenericCreateButton("ARL_RecipeButton" .. i, MainPanel.scroll_frame, 16, 224, "GameFontNormalSmall", "GameFontHighlightSmall",
+								"Blort", "LEFT", "", 0)

-	local ARL_ArmorTrinketCB = CreateFrame("CheckButton", "ARL_ArmorTrinketCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_ArmorTrinketCB, MainPanel.filter_menu.Item, L["TRINKET_DESC"], "trinket", 5, 2, 0)
-	ARL_ArmorTrinketCBText:SetText(L["Trinket"])
+			if i ~= 1 then
+				temp_state:SetPoint("TOPLEFT", MainPanel.scroll_frame.state_buttons[i - 1], "BOTTOMLEFT", 0, 3)
+				temp_recipe:SetPoint("TOPLEFT", MainPanel.scroll_frame.recipe_buttons[i - 1], "BOTTOMLEFT", 0, 3)
+			else
+				temp_state:SetPoint("TOPLEFT", MainPanel, "TOPLEFT", 20, -100)
+				temp_recipe:SetPoint("TOPLEFT", MainPanel, "TOPLEFT", 37, -100)
+			end
+			temp_state:SetScript("OnClick", RecipeItem_OnClick)
+			temp_recipe:SetScript("OnClick", RecipeItem_OnClick)

-	local ARL_ArmorShieldCB = CreateFrame("CheckButton", "ARL_ArmorShieldCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_ArmorShieldCB, MainPanel.filter_menu.Item, L["SHIELD_DESC"], "shield", 6, 1, 0)
-	ARL_ArmorShieldCBText:SetText(L["Shield"])
+			MainPanel.scroll_frame.state_buttons[i] = temp_state
+			MainPanel.scroll_frame.recipe_buttons[i] = temp_recipe
+		end
+	end	-- do

 	-------------------------------------------------------------------------------
-	--			Weapon:
-	--				() 1H		() 2H
-	--				() Dagger	() Axe
-	--				() Mace		() Sword
-	--				() Polearm	() Thrown
-	--				() Bow		() Crossbow
-	--				() Staff    () Fist
+	-- EXPANDED : 7 buttons for opening/closing the filter menu
 	-------------------------------------------------------------------------------
-	local ARL_WeaponButton = GenericCreateButton("ARL_WeaponButton", MainPanel.filter_menu.Item, 20, 105, "GameFontHighlight", "GameFontHighlightSmall", L["Weapon"] .. ":",
-						     "LEFT", L["WEAPON_TEXT_DESC"], 0)
-	ARL_WeaponButton:SetPoint("TOPLEFT", MainPanel.filter_menu.Item, "TOPLEFT", -2, -122)
+	ARL_ExpGeneralOptCB = CreateFilterMenuButton("ARL_ExpGeneralOptCB", "INV_Misc_Note_06", 1)
+	ARL_ExpGeneralOptCB:SetPoint("TOPRIGHT", MainPanel.filter_toggle, "BOTTOMLEFT", -7, -50)

-	ARL_WeaponButton:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight")
-	ARL_WeaponButton:RegisterForClicks("LeftButtonUp", "RightButtonUp")
-	ARL_WeaponButton:SetScript("OnClick",
-				   function(self, button)
-					   local weapondb = addon.db.profile.filters.item.weapon
+	ARL_ExpObtainOptCB = CreateFilterMenuButton("ARL_ExpObtainOptCB", "Spell_Shadow_MindRot", 2)
+	ARL_ExpObtainOptCB:SetPoint("TOPLEFT", ARL_ExpGeneralOptCB, "BOTTOMLEFT", 0, -8)

-					   if button == "LeftButton" then
-						   -- Reset all weapon to true
-						   for weapon in pairs(weapondb) do
-							   weapondb[weapon] = true
-						   end
-					   elseif button == "RightButton" then
-						   -- Reset all weapon to false
-						   for weapon in pairs(weapondb) do
-							   weapondb[weapon] = false
-						   end
-					   end
-					   -- Update the checkboxes with the new value
-					   ARL_Weapon1HCB:SetChecked(weapondb.onehand)
-					   ARL_Weapon2HCB:SetChecked(weapondb.twohand)
-					   ARL_WeaponDaggerCB:SetChecked(weapondb.dagger)
-					   ARL_WeaponAxeCB:SetChecked(weapondb.axe)
-					   ARL_WeaponMaceCB:SetChecked(weapondb.mace)
-					   ARL_WeaponSwordCB:SetChecked(weapondb.sword)
-					   ARL_WeaponPolearmCB:SetChecked(weapondb.polearm)
-					   ARL_WeaponWandCB:SetChecked(weapondb.wand)
-					   ARL_WeaponThrownCB:SetChecked(weapondb.thrown)
-					   ARL_WeaponAmmoCB:SetChecked(weapondb.ammo)
-					   ARL_WeaponFistCB:SetChecked(weapondb.fist)
-					   ARL_WeaponGunCB:SetChecked(weapondb.gun)
-					   -- Reset our title
-					   MainPanel:UpdateTitle()
-					   -- Use new filters
-					   ReDisplay()
-				   end)
+	ARL_ExpBindingOptCB = CreateFilterMenuButton("ARL_ExpBindingOptCB", "INV_Belt_20", 3)
+	ARL_ExpBindingOptCB:SetPoint("TOPLEFT", ARL_ExpObtainOptCB, "BOTTOMLEFT", -0, -8)

-	local ARL_Weapon1HCB = CreateFrame("CheckButton", "ARL_Weapon1HCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_Weapon1HCB, MainPanel.filter_menu.Item, L["ONEHAND_DESC"], "onehand", 9, 1, 0)
-	ARL_Weapon1HCBText:SetText(L["One Hand"])
+	ARL_ExpItemOptCB = CreateFilterMenuButton("ARL_ExpItemOptCB", "INV_Misc_EngGizmos_19", 4)
+	ARL_ExpItemOptCB:SetPoint("TOPLEFT", ARL_ExpBindingOptCB, "BOTTOMLEFT", -0, -8)

-	local ARL_Weapon2HCB = CreateFrame("CheckButton", "ARL_Weapon2HCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_Weapon2HCB, MainPanel.filter_menu.Item, L["TWOHAND_DESC"], "twohand", 9, 2, 0)
-	ARL_Weapon2HCBText:SetText(L["Two Hand"])
+	ARL_ExpPlayerOptCB = CreateFilterMenuButton("ARL_ExpPlayerOptCB", "INV_Misc_GroupLooking", 5)
+	ARL_ExpPlayerOptCB:SetPoint("TOPLEFT", ARL_ExpItemOptCB, "BOTTOMLEFT", -0, -8)

-	local ARL_WeaponDaggerCB = CreateFrame("CheckButton", "ARL_WeaponDaggerCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_WeaponDaggerCB, MainPanel.filter_menu.Item, L["DAGGER_DESC"], "dagger", 10, 1, 0)
-	ARL_WeaponDaggerCBText:SetText(L["Dagger"])
+	ARL_ExpRepOptCB = CreateFilterMenuButton("ARL_ExpRepOptCB", "INV_Scroll_05", 6)
+	ARL_ExpRepOptCB:SetPoint("TOPLEFT", ARL_ExpPlayerOptCB, "BOTTOMLEFT", -0, -8)

-	local ARL_WeaponAxeCB = CreateFrame("CheckButton", "ARL_WeaponAxeCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_WeaponAxeCB, MainPanel.filter_menu.Item, L["AXE_DESC"], "axe", 10, 2, 0)
-	ARL_WeaponAxeCBText:SetText(L["Axe"])
+	ARL_ExpMiscOptCB = CreateFilterMenuButton("ARL_ExpMiscOptCB", "Trade_Engineering", 7)
+	ARL_ExpMiscOptCB:SetPoint("TOPLEFT", ARL_ExpRepOptCB, "BOTTOMLEFT", -0, -8)

-	local ARL_WeaponMaceCB = CreateFrame("CheckButton", "ARL_WeaponMaceCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_WeaponMaceCB, MainPanel.filter_menu.Item, L["MACE_DESC"], "mace", 11, 1, 0)
-	ARL_WeaponMaceCBText:SetText(L["Mace"])
+	-------------------------------------------------------------------------------
+	-- Flyaway virtual frames to group buttons/text easily (and make them easy to show/hide)
+	-------------------------------------------------------------------------------
+	MainPanel.filter_menu.General = CreateFrame("Frame", "ARL_FilterMenu_General", MainPanel.filter_menu)
+	MainPanel.filter_menu.General:SetWidth(FILTERMENU_SMALL)
+	MainPanel.filter_menu.General:SetHeight(280)
+	MainPanel.filter_menu.General:EnableMouse(true)
+	MainPanel.filter_menu.General:EnableKeyboard(true)
+	MainPanel.filter_menu.General:SetMovable(false)
+	MainPanel.filter_menu.General:SetPoint("TOPLEFT", MainPanel.filter_menu, "TOPLEFT", 17, -16)
+	MainPanel.filter_menu.General:Hide()

-	local ARL_WeaponSwordCB = CreateFrame("CheckButton", "ARL_WeaponSwordCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_WeaponSwordCB, MainPanel.filter_menu.Item, L["SWORD_DESC"], "sword", 11, 2, 0)
-	ARL_WeaponSwordCBText:SetText(L["Sword"])

-	local ARL_WeaponPolearmCB = CreateFrame("CheckButton", "ARL_WeaponPolearmCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_WeaponPolearmCB, MainPanel.filter_menu.Item, L["POLEARM_DESC"], "polearm", 12, 1, 0)
-	ARL_WeaponPolearmCBText:SetText(L["Polearm"])
+	-------------------------------------------------------------------------------
+	--			() Craft Specialty recipes
+	--			() All skill levels
+	--			() Cross-Faction
+	--			() Known
+	--			() Unknown
+	--			Classes:
+	--			() Deathknight
+	--			() Druid
+	--			() Hunter
+	--			() Mage
+	--			() Paladin
+	--			() Priest
+	--			() Rogue
+	--			() Shaman
+	--			() Warlock
+	--			() Warrior
+	-------------------------------------------------------------------------------
+	local ARL_SpecialtyCB = CreateFrame("CheckButton", "ARL_SpecialtyCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_SpecialtyCB, MainPanel.filter_menu.General, L["SPECIALTY_DESC"], "specialty", 1, 1, 0)
+	ARL_SpecialtyCBText:SetText(L["Specialties"])
+
+	local ARL_LevelCB = CreateFrame("CheckButton", "ARL_LevelCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_LevelCB, MainPanel.filter_menu.General, L["SKILL_DESC"], "skill", 2, 1, 0)
+	ARL_LevelCBText:SetText(_G.SKILL)

-	local ARL_WeaponFistCB = CreateFrame("CheckButton", "ARL_WeaponFistCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_WeaponFistCB, MainPanel.filter_menu.Item, L["FIST_DESC"], "fist", 12, 2, 0)
-	ARL_WeaponFistCBText:SetText(L["Fist"])
+	local ARL_FactionCB = CreateFrame("CheckButton", "ARL_FactionCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_FactionCB, MainPanel.filter_menu.General, L["FACTION_DESC"], "faction", 3, 1, 0)
+	ARL_FactionCBText:SetText(_G.FACTION)

-	local ARL_WeaponStaffCB = CreateFrame("CheckButton", "ARL_WeaponStaffCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_WeaponStaffCB, MainPanel.filter_menu.Item, L["STAFF_DESC"], "staff", 13, 1, 0)
-	ARL_WeaponStaffCBText:SetText(L["Staff"])
-	ARL_WeaponStaffCBText:SetText(addon:Grey(L["Staff"]))
-	ARL_WeaponStaffCB:Disable()
+	local ARL_KnownCB = CreateFrame("CheckButton", "ARL_KnownCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_KnownCB, MainPanel.filter_menu.General, L["KNOWN_DESC"], "known", 4, 1, 0)
+	ARL_KnownCBText:SetText(L["Show Known"])

-	local ARL_WeaponWandCB = CreateFrame("CheckButton", "ARL_WeaponWandCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_WeaponWandCB, MainPanel.filter_menu.Item, L["WAND_DESC"], "wand", 13, 2, 0)
-	ARL_WeaponWandCBText:SetText(L["Wand"])
+	local ARL_UnknownCB = CreateFrame("CheckButton", "ARL_UnknownCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_UnknownCB, MainPanel.filter_menu.General, L["UNKNOWN_DESC"], "unknown", 5, 1, 0)
+	ARL_UnknownCBText:SetText(L["Show Unknown"])

-	local ARL_WeaponThrownCB = CreateFrame("CheckButton", "ARL_WeaponThrownCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_WeaponThrownCB, MainPanel.filter_menu.Item, L["THROWN_DESC"], "thrown", 14, 1, 0)
-	ARL_WeaponThrownCBText:SetText(L["Thrown"])
+	local ARL_ClassButton = GenericCreateButton("ARL_ClassButton", MainPanel.filter_menu.General, 20, 105, "GameFontHighlight", "GameFontHighlightSmall",
+						    L["Classes"] .. ":", "LEFT", L["CLASS_TEXT_DESC"], 0)
+	ARL_ClassButton:SetPoint("TOPLEFT", ARL_UnknownCB, "BOTTOMLEFT", -4, 6)

-	local ARL_WeaponBowCB = CreateFrame("CheckButton", "ARL_WeaponBowCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_WeaponBowCB, MainPanel.filter_menu.Item, L["BOW_DESC"], "bow", 14, 2, 0)
-	ARL_WeaponBowCBText:SetText(L["Bow"])
-	ARL_WeaponBowCBText:SetText(addon:Grey(L["Bow"]))
-	ARL_WeaponBowCB:Disable()
+	ARL_ClassButton:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight")
+	ARL_ClassButton:RegisterForClicks("LeftButtonUp", "RightButtonUp")
+	ARL_ClassButton:SetScript("OnClick",
+				  function(self, button)
+					  local filterdb = addon.db.profile.filters

-	local ARL_WeaponCrossbowCB = CreateFrame("CheckButton", "ARL_WeaponCrossbowCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_WeaponCrossbowCB, MainPanel.filter_menu.Item, L["CROSSBOW_DESC"], "crossbow", 15, 1, 0)
-	ARL_WeaponCrossbowCBText:SetText(L["Crossbow"])
-	ARL_WeaponCrossbowCBText:SetText(addon:Grey(L["Crossbow"]))
-	ARL_WeaponCrossbowCB:Disable()
+					  if button == "LeftButton" then
+						  for class in pairs(filterdb.classes) do
+							  filterdb.classes[class] = true
+						  end
+					  elseif button == "RightButton" then
+						  for class in pairs(filterdb.classes) do
+							  filterdb.classes[class] = false
+						  end
+						  -- Set your own class to true
+						  filterdb.classes[strlower(Player["Class"])] = true
+					  end

-	local ARL_WeaponAmmoCB = CreateFrame("CheckButton", "ARL_WeaponAmmoCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_WeaponAmmoCB, MainPanel.filter_menu.Item, L["AMMO_DESC"], "ammo", 15, 2, 0)
-	ARL_WeaponAmmoCBText:SetText(L["Ammo"])
+					  -- Update the checkboxes with the new value
+					  ARL_DeathKnightCB:SetChecked(filterdb.classes.deathknight)
+					  ARL_DruidCB:SetChecked(filterdb.classes.druid)
+					  ARL_HunterCB:SetChecked(filterdb.classes.hunter)
+					  ARL_MageCB:SetChecked(filterdb.classes.mage)
+					  ARL_PaladinCB:SetChecked(filterdb.classes.paladin)
+					  ARL_PriestCB:SetChecked(filterdb.classes.priest)
+					  ARL_RogueCB:SetChecked(filterdb.classes.rogue)
+					  ARL_ShamanCB:SetChecked(filterdb.classes.shaman)
+					  ARL_WarlockCB:SetChecked(filterdb.classes.warlock)
+					  ARL_WarriorCB:SetChecked(filterdb.classes.warrior)
+					  -- Reset our title
+					  MainPanel:UpdateTitle()
+					  -- Use new filters
+					  ReDisplay()
+				  end)

-	local ARL_WeaponGunCB = CreateFrame("CheckButton", "ARL_WeaponGunCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_WeaponGunCB, MainPanel.filter_menu.Item, L["GUN_DESC"], "gun", 16, 1, 0)
-	ARL_WeaponGunCBText:SetText(L["Gun"])
+	-- Get the localized class names
+	local BCM = LOCALIZED_CLASS_NAMES_MALE
+	--local BCF = LOCALIZED_CLASS_NAMES_FEMALE

-	MainPanel.filter_menu.Player = CreateFrame("Frame", "ARL_FilterMenu_Player", MainPanel.filter_menu)
-	MainPanel.filter_menu.Player:SetWidth(FILTERMENU_SMALL)
-	MainPanel.filter_menu.Player:SetHeight(280)
-	MainPanel.filter_menu.Player:EnableMouse(true)
-	MainPanel.filter_menu.Player:EnableKeyboard(true)
-	MainPanel.filter_menu.Player:SetMovable(false)
-	MainPanel.filter_menu.Player:SetPoint("TOPLEFT", MainPanel.filter_menu, "TOPLEFT", 17, -16)
-	MainPanel.filter_menu.Player:Hide()
+	local ARL_DeathKnightCB = CreateFrame("CheckButton", "ARL_DeathKnightCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_DeathKnightCB, MainPanel.filter_menu.General, L["CLASS_DESC"], "deathknight", 7, 1, 0)
+	ARL_DeathKnightCBText:SetText(BCM["DEATHKNIGHT"])

-	local ARL_PlayerTankCB = CreateFrame("CheckButton", "ARL_PlayerTankCB", MainPanel.filter_menu.Player, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_PlayerTankCB, MainPanel.filter_menu.Player, L["TANKS_DESC"], "tank", 1, 1, 0)
-	ARL_PlayerTankCBText:SetText(_G.TANK)
+	local ARL_DruidCB = CreateFrame("CheckButton", "ARL_DruidCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_DruidCB, MainPanel.filter_menu.General, L["CLASS_DESC"], "druid", 8, 1, 0)
+	ARL_DruidCBText:SetText(BCM["DRUID"])

-	local ARL_PlayerMeleeCB = CreateFrame("CheckButton", "ARL_PlayerMeleeCB", MainPanel.filter_menu.Player, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_PlayerMeleeCB, MainPanel.filter_menu.Player, L["MELEE_DPS_DESC"], "melee", 2, 1, 0)
-	ARL_PlayerMeleeCBText:SetText(_G.MELEE)
+	local ARL_HunterCB = CreateFrame("CheckButton", "ARL_HunterCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_HunterCB, MainPanel.filter_menu.General, L["CLASS_DESC"], "hunter", 9, 1, 0)
+	ARL_HunterCBText:SetText(BCM["HUNTER"])

-	local ARL_PlayerHealerCB = CreateFrame("CheckButton", "ARL_PlayerHealerCB", MainPanel.filter_menu.Player, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_PlayerHealerCB, MainPanel.filter_menu.Player, L["HEALERS_DESC"], "healer", 3, 1, 0)
-	ARL_PlayerHealerCBText:SetText(_G.HEALER)
+	local ARL_MageCB = CreateFrame("CheckButton", "ARL_MageCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_MageCB, MainPanel.filter_menu.General, L["CLASS_DESC"], "mage", 10, 1, 0)
+	ARL_MageCBText:SetText(BCM["MAGE"])

-	local ARL_PlayerCasterCB = CreateFrame("CheckButton", "ARL_PlayerCasterCB", MainPanel.filter_menu.Player, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_PlayerCasterCB, MainPanel.filter_menu.Player, L["CASTER_DPS_DESC"], "caster", 4, 1, 0)
-	ARL_PlayerCasterCBText:SetText(_G.DAMAGER)
+	local ARL_PaladinCB = CreateFrame("CheckButton", "ARL_PaladinCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_PaladinCB, MainPanel.filter_menu.General, L["CLASS_DESC"], "paladin", 11, 1, 0)
+	ARL_PaladinCBText:SetText(BCM["PALADIN"])

-	MainPanel.filter_menu.Rep = CreateFrame("Frame", "ARL_FilterMenu_Rep", MainPanel.filter_menu)
-	MainPanel.filter_menu.Rep:SetWidth(FILTERMENU_SMALL)
-	MainPanel.filter_menu.Rep:SetHeight(280)
-	MainPanel.filter_menu.Rep:EnableMouse(true)
-	MainPanel.filter_menu.Rep:EnableKeyboard(true)
-	MainPanel.filter_menu.Rep:SetMovable(false)
-	MainPanel.filter_menu.Rep:SetPoint("TOPLEFT", MainPanel.filter_menu, "TOPLEFT", 17, -16)
-	MainPanel.filter_menu.Rep:Hide()
+	local ARL_PriestCB = CreateFrame("CheckButton", "ARL_PriestCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_PriestCB, MainPanel.filter_menu.General, L["CLASS_DESC"], "priest", 12, 1, 0)
+	ARL_PriestCBText:SetText(BCM["PRIEST"])

-	do
-		-- Rep Filtering panel switcher
-		local function RepFilterSwitch(whichrep)
-			-- 1	ARL_Rep_ClassicCB		Old World Rep
-			-- 2	ARL_Rep_BCCB				Burning Crusade
-			-- 3	ARL_Rep_LKCB				Wrath of the Lich King
-			local ShowPanel = false
+	local ARL_RogueCB = CreateFrame("CheckButton", "ARL_RogueCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RogueCB, MainPanel.filter_menu.General, L["CLASS_DESC"], "rogue", 13, 1, 0)
+	ARL_RogueCBText:SetText(BCM["ROGUE"])

-			if whichrep == 1 then
-				if ARL_Rep_ClassicCB:GetChecked() then
-					ShowPanel = true
-					MainPanel.filter_menu.Rep.Classic:Show()
-					MainPanel.filter_menu.Rep.BC:Hide()
-					MainPanel.filter_menu.Rep.LK:Hide()
-					ARL_Rep_BCCB:SetChecked(false)
-					ARL_Rep_LKCB:SetChecked(false)
-				else
-					ShowPanel = false
-				end
-			elseif whichrep == 2 then
-				if ARL_Rep_BCCB:GetChecked() then
-					ShowPanel = true
-					MainPanel.filter_menu.Rep.Classic:Hide()
-					MainPanel.filter_menu.Rep.BC:Show()
-					MainPanel.filter_menu.Rep.LK:Hide()
-					ARL_Rep_ClassicCB:SetChecked(false)
-					ARL_Rep_LKCB:SetChecked(false)
-				else
-					ShowPanel = false
-				end
-			else -- whichrep == 3 (WotLK)
-				if ARL_Rep_LKCB:GetChecked() then
-					ShowPanel = true
-					MainPanel.filter_menu.Rep.Classic:Hide()
-					MainPanel.filter_menu.Rep.BC:Hide()
-					MainPanel.filter_menu.Rep.LK:Show()
-					ARL_Rep_ClassicCB:SetChecked(false)
-					ARL_Rep_BCCB:SetChecked(false)
-				else
-					ShowPanel = false
-				end
-			end
-			local texture = MainPanel.filter_menu.texture
-			texture:ClearAllPoints()
+	local ARL_ShamanCB = CreateFrame("CheckButton", "ARL_ShamanCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_ShamanCB, MainPanel.filter_menu.General, L["CLASS_DESC"], "shaman", 14, 1, 0)
+	ARL_ShamanCBText:SetText(BCM["SHAMAN"])

-			if ShowPanel then
-				MainPanel.filter_menu:SetWidth(FILTERMENU_DOUBLE_WIDTH)
+	local ARL_WarlockCB = CreateFrame("CheckButton", "ARL_WarlockCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_WarlockCB, MainPanel.filter_menu.General, L["CLASS_DESC"], "warlock", 15, 1, 0)
+	ARL_WarlockCBText:SetText(BCM["WARLOCK"])

-				texture:SetTexture([[Interface\Addons\AckisRecipeList\img\fly_repcol]])
-				texture:SetAllPoints(MainPanel.filter_menu)
-				texture:SetTexCoord(0, (FILTERMENU_DOUBLE_WIDTH/512), 0, (FILTERMENU_HEIGHT/512))
+	local ARL_WarriorCB = CreateFrame("CheckButton", "ARL_WarriorCB", MainPanel.filter_menu.General, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_WarriorCB, MainPanel.filter_menu.General, L["CLASS_DESC"], "warrior", 16, 1, 0)
+	ARL_WarriorCBText:SetText(BCM["WARRIOR"])

-				MainPanel.filter_menu.Rep.Classic:SetPoint("TOPRIGHT", MainPanel.filter_menu, "TOPRIGHT", -7, -14)
-				MainPanel.filter_menu.Rep.BC:SetPoint("TOPRIGHT", MainPanel.filter_menu, "TOPRIGHT", -7, -14)
-				MainPanel.filter_menu.Rep.LK:SetPoint("TOPRIGHT", MainPanel.filter_menu, "TOPRIGHT", -7, -14)
-			else
-				MainPanel.filter_menu:SetWidth(FILTERMENU_SINGLE_WIDTH)
+	MainPanel.filter_menu.Obtain = CreateFrame("Frame", "ARL_FilterMenu_Obtain", MainPanel.filter_menu)
+	MainPanel.filter_menu.Obtain:SetWidth(FILTERMENU_SMALL)
+	MainPanel.filter_menu.Obtain:SetHeight(280)
+	MainPanel.filter_menu.Obtain:EnableMouse(true)
+	MainPanel.filter_menu.Obtain:EnableKeyboard(true)
+	MainPanel.filter_menu.Obtain:SetMovable(false)
+	MainPanel.filter_menu.Obtain:SetPoint("TOPLEFT", MainPanel.filter_menu, "TOPLEFT", 17, -16)
+	MainPanel.filter_menu.Obtain:Hide()

-				texture:SetTexture([[Interface\Addons\AckisRecipeList\img\fly_1col]])
-				texture:SetAllPoints(MainPanel.filter_menu)
-				texture:SetTexCoord(0, (FILTERMENU_SINGLE_WIDTH/256), 0, (FILTERMENU_HEIGHT/512))
+	-------------------------------------------------------------------------------
+	--			() Instance	() Raid
+	--			() Quest	() Seasonal
+	--			() Trainer	() Vendor
+	--			() PVP		() Discovery
+	--			() World Drop	() Mob Drop
+	-------------------------------------------------------------------------------
+	local ARL_InstanceCB = CreateFrame("CheckButton", "ARL_InstanceCB", MainPanel.filter_menu.Obtain, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_InstanceCB, MainPanel.filter_menu.Obtain, L["INSTANCE_DESC"], "instance", 1, 1, 0)
+	ARL_InstanceCBText:SetText(_G.INSTANCE)

-				MainPanel.filter_menu.Rep.Classic:Hide()
-				MainPanel.filter_menu.Rep.BC:Hide()
-				MainPanel.filter_menu.Rep.LK:Hide()
+	local ARL_RaidCB = CreateFrame("CheckButton", "ARL_RaidCB", MainPanel.filter_menu.Obtain, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RaidCB, MainPanel.filter_menu.Obtain, L["RAID_DESC"], "raid", 2, 1, 0)
+	ARL_RaidCBText:SetText(_G.RAID)

-				ARL_Rep_ClassicCB:SetChecked(false)
-				ARL_Rep_BCCB:SetChecked(false)
-				ARL_Rep_LKCB:SetChecked(false)
-			end
-		end
+	local ARL_QuestCB = CreateFrame("CheckButton", "ARL_QuestCB", MainPanel.filter_menu.Obtain, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_QuestCB, MainPanel.filter_menu.Obtain, L["QUEST_DESC"], "quest", 3, 1, 0)
+	ARL_QuestCBText:SetText(L["Quest"])

-		ARL_Rep_ClassicCB = CreateFilterMenuButton("ARL_Rep_ClassicCB", "Glues-WoW-Logo", 1)
-		ARL_Rep_ClassicCB:SetPoint("TOPLEFT", MainPanel.filter_menu.Rep, "TOPLEFT", 0, -10)
-		ARL_Rep_ClassicCB:SetScript("OnClick",
-					    function()
-						    RepFilterSwitch(1)
-					    end)
+	local ARL_SeasonalCB = CreateFrame("CheckButton", "ARL_SeasonalCB", MainPanel.filter_menu.Obtain, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_SeasonalCB, MainPanel.filter_menu.Obtain, L["SEASONAL_DESC"], "seasonal", 4, 1, 0)
+	ARL_SeasonalCBText:SetText(SEASONAL_CATEGORY)

-		ARL_Rep_BCCB = CreateFilterMenuButton("ARL_Rep_BCCB", "GLUES-WOW-BCLOGO", 1)
-		ARL_Rep_BCCB:SetPoint("TOPLEFT", MainPanel.filter_menu.Rep, "TOPLEFT", 0, -60)
-		ARL_Rep_BCCB:SetScript("OnClick",
-				      function()
-					      RepFilterSwitch(2)
-				      end)
+	local ARL_TrainerCB = CreateFrame("CheckButton", "ARL_TrainerCB", MainPanel.filter_menu.Obtain, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_TrainerCB, MainPanel.filter_menu.Obtain, L["TRAINER_DESC"], "trainer", 5, 1, 0)
+	ARL_TrainerCBText:SetText(L["Trainer"])

-		ARL_Rep_LKCB = CreateFilterMenuButton("ARL_Rep_LKCB", "wotlk_logo", 1)
-		ARL_Rep_LKCB:SetPoint("TOPLEFT", MainPanel.filter_menu.Rep, "TOPLEFT", 0, -110)
-		ARL_Rep_LKCB:SetScript("OnClick",
-				      function()
-					      RepFilterSwitch(3)
-				      end)
-	end
-	-------------------------------------------------------------------------------
-	-- Original Reputations
-	-------------------------------------------------------------------------------
-	MainPanel.filter_menu.Rep.Classic = CreateFrame("Frame", "ARL_FilterMenu_Rep_Classic", MainPanel.filter_menu.Rep)
-	MainPanel.filter_menu.Rep.Classic:SetWidth(150)
-	MainPanel.filter_menu.Rep.Classic:SetHeight(280)
-	MainPanel.filter_menu.Rep.Classic:EnableMouse(true)
-	MainPanel.filter_menu.Rep.Classic:EnableKeyboard(true)
-	MainPanel.filter_menu.Rep.Classic:SetMovable(false)
-	MainPanel.filter_menu.Rep.Classic:SetPoint("TOPRIGHT", MainPanel.filter_menu, "TOPRIGHT", -7, -16)
-	MainPanel.filter_menu.Rep.Classic:Hide()
+	local ARL_VendorCB = CreateFrame("CheckButton", "ARL_VendorCB", MainPanel.filter_menu.Obtain, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_VendorCB, MainPanel.filter_menu.Obtain, L["VENDOR_DESC"], "vendor", 6, 1, 0)
+	ARL_VendorCBText:SetText(L["Vendor"])

-	local ARL_Rep_ClassicButton = GenericCreateButton("ARL_Rep_ClassicButton", MainPanel.filter_menu.Rep.Classic, 20, 140, "GameFontHighlight", "GameFontHighlightSmall",
-							  _G.REPUTATION .. ":", "LEFT", L["REP_TEXT_DESC"], 0)
-	ARL_Rep_ClassicButton:SetPoint("TOPLEFT", MainPanel.filter_menu.Rep.Classic, "TOPLEFT", -2, -4)
+	local ARL_PVPCB = CreateFrame("CheckButton", "ARL_PVPCB", MainPanel.filter_menu.Obtain, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_PVPCB, MainPanel.filter_menu.Obtain, L["PVP_DESC"], "pvp", 7, 1, 0)
+	ARL_PVPCBText:SetText(_G.PVP)

-	ARL_Rep_ClassicButton:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight")
-	ARL_Rep_ClassicButton:RegisterForClicks("LeftButtonUp", "RightButtonUp")
-	ARL_Rep_ClassicButton:SetScript("OnClick",
-				   function(self,button)
-					   local filterdb = addon.db.profile.filters.rep
-					   if button == "LeftButton" then
-						   -- Set all Reputations to true
-						   filterdb.argentdawn = true
-						   filterdb.cenarioncircle = true
-						   filterdb.thoriumbrotherhood = true
-						   filterdb.timbermaw = true
-						   filterdb.zandalar = true
-					   elseif button == "RightButton" then
-						   -- Set all Reputations to false
-						   filterdb.argentdawn = false
-						   filterdb.cenarioncircle = false
-						   filterdb.thoriumbrotherhood = false
-						   filterdb.timbermaw = false
-						   filterdb.zandalar = false
-					   end
-					   -- Update the checkboxes with the new value
-					   ARL_RepArgentDawnCB:SetChecked(filterdb.argentdawn)
-					   ARL_RepCenarionCircleCB:SetChecked(filterdb.cenarioncircle)
-					   ARL_RepThoriumCB:SetChecked(filterdb.thoriumbrotherhood)
-					   ARL_RepTimbermawCB:SetChecked(filterdb.timbermaw)
-					   ARL_RepZandalarCB:SetChecked(filterdb.zandalar)
-					   -- Reset our title
-					   MainPanel:UpdateTitle()
-					   -- Use new filters
-					   ReDisplay()
-				   end)
+	local ARL_DiscoveryCB = CreateFrame("CheckButton", "ARL_DiscoveryCB", MainPanel.filter_menu.Obtain, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_DiscoveryCB, MainPanel.filter_menu.Obtain, L["DISCOVERY_DESC"], "discovery", 8, 1, 0)
+	ARL_DiscoveryCBText:SetText(L["Discovery"])

-	local ARL_RepArgentDawnCB = CreateFrame("CheckButton", "ARL_RepArgentDawnCB", MainPanel.filter_menu.Rep.Classic, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepArgentDawnCB, MainPanel.filter_menu.Rep.Classic,sformat(L["SPECIFIC_REP_DESC"], BFAC["Argent Dawn"]), "argentdawn", 2, 1, 0)
-	ARL_RepArgentDawnCBText:SetText(BFAC["Argent Dawn"])
-	ARL_RepArgentDawnCBText:SetFont(narrowFont, 11)
+	local ARL_WorldDropCB = CreateFrame("CheckButton", "ARL_WorldDropCB", MainPanel.filter_menu.Obtain, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_WorldDropCB, MainPanel.filter_menu.Obtain, L["WORLD_DROP_DESC"], "worlddrop", 9, 1, 0)
+	ARL_WorldDropCBText:SetText(L["World Drop"])

-	local ARL_RepCenarionCircleCB = CreateFrame("CheckButton", "ARL_RepCenarionCircleCB", MainPanel.filter_menu.Rep.Classic, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepCenarionCircleCB, MainPanel.filter_menu.Rep.Classic,sformat(L["SPECIFIC_REP_DESC"], BFAC["Cenarion Circle"]), "cenarioncircle", 3, 1, 0)
-	ARL_RepCenarionCircleCBText:SetText(BFAC["Cenarion Circle"])
-	ARL_RepCenarionCircleCBText:SetFont(narrowFont, 11)
+	local ARL_MobDropCB = CreateFrame("CheckButton", "ARL_MobDropCB", MainPanel.filter_menu.Obtain, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_MobDropCB, MainPanel.filter_menu.Obtain, L["MOB_DROP_DESC"], "mobdrop", 10, 1, 0)
+	ARL_MobDropCBText:SetText(L["Mob Drop"])

-	local ARL_RepThoriumCB = CreateFrame("CheckButton", "ARL_RepThoriumCB", MainPanel.filter_menu.Rep.Classic, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepThoriumCB, MainPanel.filter_menu.Rep.Classic,sformat(L["SPECIFIC_REP_DESC"], BFAC["Thorium Brotherhood"]), "thoriumbrotherhood", 4, 1, 0)
-	ARL_RepThoriumCBText:SetText(BFAC["Thorium Brotherhood"])
-	ARL_RepThoriumCBText:SetFont(narrowFont, 11)
+	local ARL_OriginalWoWCB = CreateFrame("CheckButton", "ARL_OriginalWoWCB", MainPanel.filter_menu.Obtain, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_OriginalWoWCB, MainPanel.filter_menu.Obtain, L["ORIGINAL_WOW_DESC"], "originalwow", 12, 1, 0)
+	ARL_OriginalWoWCBText:SetText(_G.EXPANSION_NAME0)

-	local ARL_RepTimbermawCB = CreateFrame("CheckButton", "ARL_RepTimbermawCB", MainPanel.filter_menu.Rep.Classic, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepTimbermawCB, MainPanel.filter_menu.Rep.Classic,sformat(L["SPECIFIC_REP_DESC"], BFAC["Timbermaw Hold"]), "timbermaw", 5, 1, 0)
-	ARL_RepTimbermawCBText:SetText(BFAC["Timbermaw Hold"])
-	ARL_RepTimbermawCBText:SetFont(narrowFont, 11)
+	local ARL_BCCB = CreateFrame("CheckButton", "ARL_BCCB", MainPanel.filter_menu.Obtain, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_BCCB, MainPanel.filter_menu.Obtain, L["BC_WOW_DESC"], "bc", 13, 1, 0)
+	ARL_BCCBText:SetText(_G.EXPANSION_NAME1)

-	local ARL_RepZandalarCB = CreateFrame("CheckButton", "ARL_RepZandalarCB", MainPanel.filter_menu.Rep.Classic, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepZandalarCB, MainPanel.filter_menu.Rep.Classic,sformat(L["SPECIFIC_REP_DESC"], BFAC["Zandalar Tribe"]), "zandalar", 6, 1, 0)
-	ARL_RepZandalarCBText:SetText(BFAC["Zandalar Tribe"])
-	ARL_RepZandalarCBText:SetFont(narrowFont, 11)
+	local ARL_WrathCB = CreateFrame("CheckButton", "ARL_WrathCB", MainPanel.filter_menu.Obtain, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_WrathCB, MainPanel.filter_menu.Obtain, L["LK_WOW_DESC"], "wrath", 14, 1, 0)
+	ARL_WrathCBText:SetText(_G.EXPANSION_NAME2)
+
+	MainPanel.filter_menu.Binding = CreateFrame("Frame", "ARL_FilterMenu_Binding", MainPanel.filter_menu)
+	MainPanel.filter_menu.Binding:SetWidth(FILTERMENU_LARGE)
+	MainPanel.filter_menu.Binding:SetHeight(280)
+	MainPanel.filter_menu.Binding:EnableMouse(true)
+	MainPanel.filter_menu.Binding:EnableKeyboard(true)
+	MainPanel.filter_menu.Binding:SetMovable(false)
+	MainPanel.filter_menu.Binding:SetPoint("TOPLEFT", MainPanel.filter_menu, "TOPLEFT", 17, -16)
+	MainPanel.filter_menu.Binding:Hide()

 	-------------------------------------------------------------------------------
-	-- The Burning Crusade Reputations
+	--			() Crafted Item is Bind on Equip
+	--			() Crafted Item is Bind on Pickup
+	--			() Recipe is Bind on Equip
+	--			() Recipe is Bind on Pickup
 	-------------------------------------------------------------------------------
-	MainPanel.filter_menu.Rep.BC = CreateFrame("Frame", "ARL_FilterMenu_Rep_BC", MainPanel.filter_menu.Rep)
-	MainPanel.filter_menu.Rep.BC:SetWidth(150)
-	MainPanel.filter_menu.Rep.BC:SetHeight(280)
-	MainPanel.filter_menu.Rep.BC:EnableMouse(true)
-	MainPanel.filter_menu.Rep.BC:EnableKeyboard(true)
-	MainPanel.filter_menu.Rep.BC:SetMovable(false)
-	MainPanel.filter_menu.Rep.BC:SetPoint("TOPRIGHT", MainPanel.filter_menu, "TOPRIGHT", -7, -16)
-	MainPanel.filter_menu.Rep.BC:Hide()
+	local ARL_iBoECB = CreateFrame("CheckButton", "ARL_iBoECB", MainPanel.filter_menu.Binding, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_iBoECB, MainPanel.filter_menu.Binding, L["BOE_DESC"], "itemboe", 1, 1, 0)
+	ARL_iBoECBText:SetText(L["BOEFilter"])

-	local ARL_Rep_BCButton = GenericCreateButton("ARL_Rep_ClassicButton", MainPanel.filter_menu.Rep.BC, 20, 140, "GameFontHighlight", "GameFontHighlightSmall",
-						     _G.REPUTATION .. ":", "LEFT", L["REP_TEXT_DESC"], 0)
-	ARL_Rep_BCButton:SetPoint("TOPLEFT", MainPanel.filter_menu.Rep.BC, "TOPLEFT", -2, -4)
+	local ARL_iBoPCB = CreateFrame("CheckButton", "ARL_iBoPCB", MainPanel.filter_menu.Binding, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_iBoPCB, MainPanel.filter_menu.Binding, L["BOP_DESC"], "itembop", 2, 1, 0)
+	ARL_iBoPCBText:SetText(L["BOPFilter"])

-	ARL_Rep_BCButton:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight")
-	ARL_Rep_BCButton:RegisterForClicks("LeftButtonUp", "RightButtonUp")
-	ARL_Rep_BCButton:SetScript("OnClick",
-				   function(self,button)
-					   local filterdb = addon.db.profile.filters.rep
-					   if button == "LeftButton" then
-						   -- Set all Reputations to true
-						   filterdb.aldor = true
-						   filterdb.ashtonguedeathsworn = true
-						   filterdb.cenarionexpedition = true
-						   filterdb.consortium = true
-						   filterdb.hellfire = true
-						   filterdb.keepersoftime = true
-						   filterdb.nagrand = true
-						   filterdb.lowercity = true
-						   filterdb.scaleofthesands = true
-						   filterdb.scryer = true
-						   filterdb.shatar = true
-						   filterdb.shatteredsun = true
-						   filterdb.sporeggar = true
-						   filterdb.violeteye = true
-					   elseif button == "RightButton" then
-						   -- Set all Reputations to false
-						   filterdb.aldor = false
-						   filterdb.ashtonguedeathsworn = false
-						   filterdb.cenarionexpedition = false
-						   filterdb.consortium = false
-						   filterdb.hellfire = false
-						   filterdb.keepersoftime = false
-						   filterdb.nagrand = false
-						   filterdb.lowercity = false
-						   filterdb.scaleofthesands = false
-						   filterdb.scryer = false
-						   filterdb.shatar = false
-						   filterdb.shatteredsun = false
-						   filterdb.sporeggar = false
-						   filterdb.violeteye = false
-					   end
-					   -- Update the checkboxes with the new value
-					   ARL_RepAldorCB:SetChecked(filterdb.aldor)
-					   ARL_RepAshtongueCB:SetChecked(filterdb.ashtonguedeathsworn)
-					   ARL_RepCenarionExpeditionCB:SetChecked(filterdb.cenarionexpedition)
-					   ARL_RepConsortiumCB:SetChecked(filterdb.consortium)
-					   ARL_RepHonorHoldCB:SetChecked(filterdb.hellfire)
-					   ARL_RepKeepersOfTimeCB:SetChecked(filterdb.keepersoftime)
-					   ARL_RepKurenaiCB:SetChecked(filterdb.nagrand)
-					   ARL_RepLowerCityCB:SetChecked(filterdb.lowercity)
-					   ARL_RepScaleSandsCB:SetChecked(filterdb.scaleofthesands)
-					   ARL_RepScryersCB:SetChecked(filterdb.scryer)
-					   ARL_RepShatarCB:SetChecked(filterdb.shatar)
-					   ARL_RepShatteredSunCB:SetChecked(filterdb.shatteredsun)
-					   ARL_RepSporeggarCB:SetChecked(filterdb.sporeggar)
-					   ARL_RepVioletEyeCB:SetChecked(filterdb.violeteye)
-					   -- Reset our title
-					   MainPanel:UpdateTitle()
-					   -- Use new filters
-					   ReDisplay()
-				   end)
+	local ARL_rBoECB = CreateFrame("CheckButton", "ARL_rBoECB", MainPanel.filter_menu.Binding, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_rBoECB, MainPanel.filter_menu.Binding, L["RECIPE_BOE_DESC"], "recipeboe", 3, 1, 0)
+	ARL_rBoECBText:SetText(L["RecipeBOEFilter"])

-	local ARL_RepAldorCB = CreateFrame("CheckButton", "ARL_RepAldorCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepAldorCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], BFAC["The Aldor"]), "aldor", 2, 1, 0)
-	ARL_RepAldorCBText:SetText(BFAC["The Aldor"])
-	ARL_RepAldorCBText:SetFont(narrowFont, 11)
+	local ARL_rBoPCB = CreateFrame("CheckButton", "ARL_rBoPCB", MainPanel.filter_menu.Binding, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_rBoPCB, MainPanel.filter_menu.Binding, L["RECIPE_BOP_DESC"], "recipebop", 4, 1, 0)
+	ARL_rBoPCBText:SetText(L["RecipeBOPFilter"])

-	local ARL_RepAshtongueCB = CreateFrame("CheckButton", "ARL_RepAshtongueCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepAshtongueCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], BFAC["Ashtongue Deathsworn"]), "ashtonguedeathsworn", 3, 1, 0)
-	ARL_RepAshtongueCBText:SetText(BFAC["Ashtongue Deathsworn"])
-	ARL_RepAshtongueCBText:SetFont(narrowFont, 11)
+	MainPanel.filter_menu.Item = CreateFrame("Frame", "ARL_FilterMenu_Item", MainPanel.filter_menu)
+	MainPanel.filter_menu.Item:SetWidth(FILTERMENU_LARGE)
+	MainPanel.filter_menu.Item:SetHeight(280)
+	MainPanel.filter_menu.Item:EnableMouse(true)
+	MainPanel.filter_menu.Item:EnableKeyboard(true)
+	MainPanel.filter_menu.Item:SetMovable(false)
+	MainPanel.filter_menu.Item:SetPoint("TOPLEFT", MainPanel.filter_menu, "TOPLEFT", 17, -16)
+	MainPanel.filter_menu.Item:Hide()

-	local ARL_RepCenarionExpeditionCB = CreateFrame("CheckButton", "ARL_RepCenarionExpeditionCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepCenarionExpeditionCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], BFAC["Cenarion Expedition"]), "cenarionexpedition", 4, 1, 0)
-	ARL_RepCenarionExpeditionCBText:SetText(BFAC["Cenarion Expedition"])
-	ARL_RepCenarionExpeditionCBText:SetFont(narrowFont, 11)
+	-------------------------------------------------------------------------------
+	--			Armor:
+	--				() Cloth	() Leather
+	--				() Mail		() Plate
+	--				() Cloak	() Necklace
+	--				() Rings	() Trinkets
+	--				() Shield
+	-------------------------------------------------------------------------------
+	local ARL_ArmorButton = GenericCreateButton("ARL_ArmorButton", MainPanel.filter_menu.Item, 20, 105, "GameFontHighlight", "GameFontHighlightSmall", _G.ARMOR_COLON,
+						    "LEFT", L["ARMOR_TEXT_DESC"], 0)
+	ARL_ArmorButton:SetPoint("TOPLEFT", MainPanel.filter_menu.Item, "TOPLEFT", -2, -4)

-	local ARL_RepConsortiumCB = CreateFrame("CheckButton", "ARL_RepConsortiumCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepConsortiumCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], BFAC["The Consortium"]), "consortium", 5, 1, 0)
-	ARL_RepConsortiumCBText:SetText(BFAC["The Consortium"])
-	ARL_RepConsortiumCBText:SetFont(narrowFont, 11)
+	ARL_ArmorButton:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight")
+	ARL_ArmorButton:RegisterForClicks("LeftButtonUp", "RightButtonUp")
+	ARL_ArmorButton:SetScript("OnClick",
+				  function(self, button)
+					  local armordb = addon.db.profile.filters.item.armor

-	local ARL_RepHonorHoldCB = CreateFrame("CheckButton", "ARL_RepHonorHoldCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepHonorHoldCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], HonorHold_Thrallmar_FactionText), "hellfire", 6, 1, 0)
-	ARL_RepHonorHoldCBText:SetText(HonorHold_Thrallmar_FactionText)
-	ARL_RepHonorHoldCBText:SetFont(narrowFont, 11)
+					  if button == "LeftButton" then
+						  -- Reset all armor to true
+						  for armor in pairs(armordb) do
+							  armordb[armor] = true
+						  end
+					  elseif button == "RightButton" then
+						  -- Reset all armor to false
+						  for armor in pairs(armordb) do
+							  armordb[armor] = false
+						  end
+					  end
+					  -- Update the checkboxes with the new value
+					  ARL_ArmorClothCB:SetChecked(armordb.cloth)
+					  ARL_ArmorLeatherCB:SetChecked(armordb.leather)
+					  ARL_ArmorMailCB:SetChecked(armordb.mail)
+					  ARL_ArmorPlateCB:SetChecked(armordb.plate)
+					  ARL_ArmorCloakCB:SetChecked(armordb.cloak)
+					  ARL_ArmorNecklaceCB:SetChecked(armordb.necklace)
+					  ARL_ArmorRingCB:SetChecked(armordb.ring)
+					  ARL_ArmorTrinketCB:SetChecked(armordb.trinket)
+					  ARL_ArmorShieldCB:SetChecked(armordb.shield)
+					  -- Reset our title
+					  MainPanel:UpdateTitle()
+					  -- Use new filters
+					  ReDisplay()
+				  end)

-	local ARL_RepKeepersOfTimeCB = CreateFrame("CheckButton", "ARL_RepKeepersOfTimeCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepKeepersOfTimeCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], BFAC["Keepers of Time"]), "keepersoftime", 7, 1, 0)
-	ARL_RepKeepersOfTimeCBText:SetText(BFAC["Keepers of Time"])
-	ARL_RepKeepersOfTimeCBText:SetFont(narrowFont, 11)
+	local ARL_ArmorClothCB = CreateFrame("CheckButton", "ARL_ArmorClothCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_ArmorClothCB, MainPanel.filter_menu.Item, L["CLOTH_DESC"], "cloth", 2, 1, 0)
+	ARL_ArmorClothCBText:SetText(L["Cloth"])

-	local ARL_RepKurenaiCB = CreateFrame("CheckButton", "ARL_RepKurenaiCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepKurenaiCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], Kurenai_Maghar_FactionText), "nagrand", 8, 1, 0)
-	ARL_RepKurenaiCBText:SetText(Kurenai_Maghar_FactionText)
-	ARL_RepKurenaiCBText:SetFont(narrowFont, 11)
+	local ARL_ArmorLeatherCB = CreateFrame("CheckButton", "ARL_ArmorLeatherCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_ArmorLeatherCB, MainPanel.filter_menu.Item, L["LEATHER_DESC"], "leather", 2, 2, 0)
+	ARL_ArmorLeatherCBText:SetText(L["Leather"])

-	local ARL_RepLowerCityCB = CreateFrame("CheckButton", "ARL_RepLowerCityCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepLowerCityCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], BFAC["Lower City"]), "lowercity", 9, 1, 0)
-	ARL_RepLowerCityCBText:SetText(BFAC["Lower City"])
-	ARL_RepLowerCityCBText:SetFont(narrowFont, 11)
+	local ARL_ArmorMailCB = CreateFrame("CheckButton", "ARL_ArmorMailCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_ArmorMailCB, MainPanel.filter_menu.Item, L["MAIL_DESC"], "mail", 3, 1, 0)
+	ARL_ArmorMailCBText:SetText(L["Mail"])

-	local ARL_RepScaleSandsCB = CreateFrame("CheckButton", "ARL_RepScaleSandsCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepScaleSandsCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], BFAC["The Scale of the Sands"]), "scaleofthesands", 10, 1, 0)
-	ARL_RepScaleSandsCBText:SetText(BFAC["The Scale of the Sands"])
-	ARL_RepScaleSandsCBText:SetFont(narrowFont, 11)
+	local ARL_ArmorPlateCB = CreateFrame("CheckButton", "ARL_ArmorPlateCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_ArmorPlateCB, MainPanel.filter_menu.Item, L["PLATE_DESC"], "plate", 3, 2, 0)
+	ARL_ArmorPlateCBText:SetText(L["Plate"])

-	local ARL_RepScryersCB = CreateFrame("CheckButton", "ARL_RepScryersCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepScryersCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], BFAC["The Scryers"]), "scryer", 11, 1, 0)
-	ARL_RepScryersCBText:SetText(BFAC["The Scryers"])
-	ARL_RepScryersCBText:SetFont(narrowFont, 11)
+	local ARL_ArmorCloakCB = CreateFrame("CheckButton", "ARL_ArmorCloakCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_ArmorCloakCB, MainPanel.filter_menu.Item, L["CLOAK_DESC"], "cloak", 4, 1, 0)
+	ARL_ArmorCloakCBText:SetText(L["Cloak"])

-	local ARL_RepShatarCB = CreateFrame("CheckButton", "ARL_RepShatarCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepShatarCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], BFAC["The Sha'tar"]), "shatar", 12, 1, 0)
-	ARL_RepShatarCBText:SetText(BFAC["The Sha'tar"])
-	ARL_RepShatarCBText:SetFont(narrowFont, 11)
+	local ARL_ArmorNecklaceCB = CreateFrame("CheckButton", "ARL_ArmorNecklaceCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_ArmorNecklaceCB, MainPanel.filter_menu.Item, L["NECKLACE_DESC"], "necklace", 4, 2, 0)
+	ARL_ArmorNecklaceCBText:SetText(L["Necklace"])

-	local ARL_RepShatteredSunCB = CreateFrame("CheckButton", "ARL_RepShatteredSunCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepShatteredSunCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], BFAC["Shattered Sun Offensive"]), "shatteredsun", 13, 1, 0)
-	ARL_RepShatteredSunCBText:SetText(BFAC["Shattered Sun Offensive"])
-	ARL_RepShatteredSunCBText:SetFont(narrowFont, 11)
+	local ARL_ArmorRingCB = CreateFrame("CheckButton", "ARL_ArmorRingCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_ArmorRingCB, MainPanel.filter_menu.Item, L["RING_DESC"], "ring", 5, 1, 0)
+	ARL_ArmorRingCBText:SetText(L["Ring"])

-	local ARL_RepSporeggarCB = CreateFrame("CheckButton", "ARL_RepSporeggarCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepSporeggarCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], BFAC["Sporeggar"]), "sporeggar", 14, 1, 0)
-	ARL_RepSporeggarCBText:SetText(BFAC["Sporeggar"])
-	ARL_RepSporeggarCBText:SetFont(narrowFont, 11)
+	local ARL_ArmorTrinketCB = CreateFrame("CheckButton", "ARL_ArmorTrinketCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_ArmorTrinketCB, MainPanel.filter_menu.Item, L["TRINKET_DESC"], "trinket", 5, 2, 0)
+	ARL_ArmorTrinketCBText:SetText(L["Trinket"])

-	local ARL_RepVioletEyeCB = CreateFrame("CheckButton", "ARL_RepVioletEyeCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepVioletEyeCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], BFAC["The Violet Eye"]), "violeteye", 15, 1, 0)
-	ARL_RepVioletEyeCBText:SetText(BFAC["The Violet Eye"])
-	ARL_RepVioletEyeCBText:SetFont(narrowFont, 11)
+	local ARL_ArmorShieldCB = CreateFrame("CheckButton", "ARL_ArmorShieldCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_ArmorShieldCB, MainPanel.filter_menu.Item, L["SHIELD_DESC"], "shield", 6, 1, 0)
+	ARL_ArmorShieldCBText:SetText(L["Shield"])

 	-------------------------------------------------------------------------------
-	-- Wrath of the Lich King Reputations
+	--			Weapon:
+	--				() 1H		() 2H
+	--				() Dagger	() Axe
+	--				() Mace		() Sword
+	--				() Polearm	() Thrown
+	--				() Bow		() Crossbow
+	--				() Staff    () Fist
 	-------------------------------------------------------------------------------
-	MainPanel.filter_menu.Rep.LK = CreateFrame("Frame", "ARL_FilterMenu_Rep_LK", MainPanel.filter_menu.Rep)
-	MainPanel.filter_menu.Rep.LK:SetWidth(150)
-	MainPanel.filter_menu.Rep.LK:SetHeight(280)
-	MainPanel.filter_menu.Rep.LK:EnableMouse(true)
-	MainPanel.filter_menu.Rep.LK:EnableKeyboard(true)
-	MainPanel.filter_menu.Rep.LK:SetMovable(false)
-	MainPanel.filter_menu.Rep.LK:SetPoint("TOPRIGHT", MainPanel.filter_menu, "TOPRIGHT", -7, -16)
-	MainPanel.filter_menu.Rep.LK:Hide()
+	local ARL_WeaponButton = GenericCreateButton("ARL_WeaponButton", MainPanel.filter_menu.Item, 20, 105, "GameFontHighlight", "GameFontHighlightSmall", L["Weapon"] .. ":",
+						     "LEFT", L["WEAPON_TEXT_DESC"], 0)
+	ARL_WeaponButton:SetPoint("TOPLEFT", MainPanel.filter_menu.Item, "TOPLEFT", -2, -122)

-	local ARL_Rep_LKButton = GenericCreateButton("ARL_Rep_ClassicButton", MainPanel.filter_menu.Rep.LK, 20, 140, "GameFontHighlight", "GameFontHighlightSmall",
-						     _G.REPUTATION .. ":", "LEFT", L["REP_TEXT_DESC"], 0)
-	ARL_Rep_LKButton:SetPoint("TOPLEFT", MainPanel.filter_menu.Rep.LK, "TOPLEFT", -2, -4)
+	ARL_WeaponButton:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight")
+	ARL_WeaponButton:RegisterForClicks("LeftButtonUp", "RightButtonUp")
+	ARL_WeaponButton:SetScript("OnClick",
+				   function(self, button)
+					   local weapondb = addon.db.profile.filters.item.weapon

-	ARL_Rep_LKButton:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight")
-	ARL_Rep_LKButton:RegisterForClicks("LeftButtonUp", "RightButtonUp")
-	ARL_Rep_LKButton:SetScript("OnClick",
-				   function(self,button)
-					   local filterdb = addon.db.profile.filters.rep
 					   if button == "LeftButton" then
-						   -- Set all Reputations to true
-						   filterdb.argentcrusade = true
-						   filterdb.frenzyheart = true
-						   filterdb.ebonblade = true
-						   filterdb.kirintor = true
-						   filterdb.sonsofhodir = true
-						   filterdb.kaluak = true
-						   filterdb.oracles = true
-						   filterdb.wyrmrest = true
-						   filterdb.ashenverdict = true
-						   filterdb.wrathcommon1 = true
+						   -- Reset all weapon to true
+						   for weapon in pairs(weapondb) do
+							   weapondb[weapon] = true
+						   end
 					   elseif button == "RightButton" then
-						   -- Set all Reputations to false
-						   filterdb.argentcrusade = false
-						   filterdb.frenzyheart = false
-						   filterdb.ebonblade = false
-						   filterdb.kirintor = false
-						   filterdb.sonsofhodir = false
-						   filterdb.kaluak = false
-						   filterdb.oracles = false
-						   filterdb.wyrmrest = false
-						   filterdb.ashenverdict = false
-						   filterdb.wrathcommon1 = false
+						   -- Reset all weapon to false
+						   for weapon in pairs(weapondb) do
+							   weapondb[weapon] = false
+						   end
 					   end
 					   -- Update the checkboxes with the new value
-					   ARL_RepArgentCrusadeCB:SetChecked(filterdb.argentcrusade)
-					   ARL_RepFrenzyheartCB:SetChecked(filterdb.frenzyheart)
-					   ARL_RepEbonBladeCB:SetChecked(filterdb.ebonblade)
-					   ARL_RepKirinTorCB:SetChecked(filterdb.kirintor)
-					   ARL_RepSonsOfHodirCB:SetChecked(filterdb.sonsofhodir)
-					   ARL_RepKaluakCB:SetChecked(filterdb.kaluak)
-					   ARL_RepOraclesCB:SetChecked(filterdb.oracles)
-					   ARL_RepWyrmrestCB:SetChecked(filterdb.wyrmrest)
-					   ARL_RepAshenVerdictCB:SetChecked(filterdb.ashenverdict)
-					   ARL_WrathCommon1CB:SetChecked(filterdb.wrathcommon1)
+					   ARL_Weapon1HCB:SetChecked(weapondb.onehand)
+					   ARL_Weapon2HCB:SetChecked(weapondb.twohand)
+					   ARL_WeaponDaggerCB:SetChecked(weapondb.dagger)
+					   ARL_WeaponAxeCB:SetChecked(weapondb.axe)
+					   ARL_WeaponMaceCB:SetChecked(weapondb.mace)
+					   ARL_WeaponSwordCB:SetChecked(weapondb.sword)
+					   ARL_WeaponPolearmCB:SetChecked(weapondb.polearm)
+					   ARL_WeaponWandCB:SetChecked(weapondb.wand)
+					   ARL_WeaponThrownCB:SetChecked(weapondb.thrown)
+					   ARL_WeaponAmmoCB:SetChecked(weapondb.ammo)
+					   ARL_WeaponFistCB:SetChecked(weapondb.fist)
+					   ARL_WeaponGunCB:SetChecked(weapondb.gun)
 					   -- Reset our title
 					   MainPanel:UpdateTitle()
 					   -- Use new filters
-					   ReDisplay()
-				   end)
-
-	local ARL_WrathCommon1CB = CreateFrame("CheckButton", "ARL_WrathCommon1CB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_WrathCommon1CB, MainPanel.filter_menu.Rep.LK,sformat(L["SPECIFIC_REP_DESC"],  Vanguard_Expedition_FactionText), "wrathcommon1", 2, 1, 0)
-	ARL_WrathCommon1CBText:SetText(Vanguard_Expedition_FactionText)
-	ARL_WrathCommon1CBText:SetFont(narrowFont, 11)
-
-	local ARL_RepArgentCrusadeCB = CreateFrame("CheckButton", "ARL_RepArgentCrusadeCB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepArgentCrusadeCB, MainPanel.filter_menu.Rep.LK,sformat(L["SPECIFIC_REP_DESC"], BFAC["Argent Crusade"]), "argentcrusade", 3, 1, 0)
-	ARL_RepArgentCrusadeCBText:SetText(BFAC["Argent Crusade"])
-	ARL_RepArgentCrusadeCBText:SetFont(narrowFont, 11)
-
-	local ARL_WrathCommon5CB = CreateFrame("CheckButton", "ARL_WrathCommon5CB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_WrathCommon5CB, MainPanel.filter_menu.Rep.LK,sformat(L["SPECIFIC_REP_DESC"], Explorer_Hand_FactionText), "wrathcommon5", 4, 1, 0)
-	ARL_WrathCommon5CBText:SetText(Explorer_Hand_FactionText)
-	ARL_WrathCommon5CBText:SetFont(narrowFont, 11)
-	ARL_WrathCommon5CBText:SetText(addon:Grey(Explorer_Hand_FactionText))
-	ARL_WrathCommon5CB:Disable()
-
-	local ARL_RepFrenzyheartCB = CreateFrame("CheckButton", "ARL_RepFrenzyheartCB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepFrenzyheartCB, MainPanel.filter_menu.Rep.LK,sformat(L["SPECIFIC_REP_DESC"], BFAC["Frenzyheart Tribe"]), "frenzyheart", 5, 1, 0)
-	ARL_RepFrenzyheartCBText:SetText(BFAC["Frenzyheart Tribe"])
-	ARL_RepFrenzyheartCBText:SetFont(narrowFont, 11)
-
-	local ARL_RepKaluakCB = CreateFrame("CheckButton", "ARL_RepKaluakCB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepKaluakCB, MainPanel.filter_menu.Rep.LK,sformat(L["SPECIFIC_REP_DESC"], BFAC["The Kalu'ak"]), "kaluak", 6, 1, 0)
-	ARL_RepKaluakCBText:SetText(BFAC["The Kalu'ak"])
-	ARL_RepKaluakCBText:SetFont(narrowFont, 11)
-
-	local ARL_RepKirinTorCB = CreateFrame("CheckButton", "ARL_RepKirinTorCB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepKirinTorCB, MainPanel.filter_menu.Rep.LK,sformat(L["SPECIFIC_REP_DESC"], BFAC["Kirin Tor"]), "kirintor", 7, 1, 0)
-	ARL_RepKirinTorCBText:SetText(BFAC["Kirin Tor"])
-	ARL_RepKirinTorCBText:SetFont(narrowFont, 11)
-
-	local ARL_RepEbonBladeCB = CreateFrame("CheckButton", "ARL_RepEbonBladeCB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepEbonBladeCB, MainPanel.filter_menu.Rep.LK,sformat(L["SPECIFIC_REP_DESC"], BFAC["Knights of the Ebon Blade"]), "ebonblade", 8, 1, 0)
-	ARL_RepEbonBladeCBText:SetText(BFAC["Knights of the Ebon Blade"])
-	ARL_RepEbonBladeCBText:SetFont(narrowFont, 11)
-
-	local ARL_RepOraclesCB = CreateFrame("CheckButton", "ARL_RepOraclesCB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepOraclesCB, MainPanel.filter_menu.Rep.LK,sformat(L["SPECIFIC_REP_DESC"], BFAC["The Oracles"]), "oracles", 9, 1, 0)
-	ARL_RepOraclesCBText:SetText(BFAC["The Oracles"])
-	ARL_RepOraclesCBText:SetFont(narrowFont, 11)
-
-	local ARL_WrathCommon2CB = CreateFrame("CheckButton", "ARL_WrathCommon2CB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_WrathCommon2CB, MainPanel.filter_menu.Rep.LK,sformat(L["SPECIFIC_REP_DESC"], SilverConv_Sunreaver_FactionText), "wrathcommon2", 10, 1, 0)
-	ARL_WrathCommon2CBText:SetText(SilverConv_Sunreaver_FactionText)
-	ARL_WrathCommon2CBText:SetFont(narrowFont, 11)
-	ARL_WrathCommon2CBText:SetText(addon:Grey(SilverConv_Sunreaver_FactionText))
-	ARL_WrathCommon2CB:Disable()
-
-	local ARL_RepSonsOfHodirCB = CreateFrame("CheckButton", "ARL_RepSonsOfHodirCB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepSonsOfHodirCB, MainPanel.filter_menu.Rep.LK,sformat(L["SPECIFIC_REP_DESC"], BFAC["The Sons of Hodir"]), "sonsofhodir", 11, 1, 0)
-	ARL_RepSonsOfHodirCBText:SetText(BFAC["The Sons of Hodir"])
-	ARL_RepSonsOfHodirCBText:SetFont(narrowFont, 11)
-
-	local ARL_WrathCommon4CB = CreateFrame("CheckButton", "ARL_WrathCommon4CB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_WrathCommon4CB, MainPanel.filter_menu.Rep.LK,sformat(L["SPECIFIC_REP_DESC"], Frostborn_Taunka_FactionText), "wrathcommon4", 12, 1, 0)
-	ARL_WrathCommon4CBText:SetText(Frostborn_Taunka_FactionText)
-	ARL_WrathCommon4CBText:SetFont(narrowFont, 11)
-	ARL_WrathCommon4CBText:SetText(addon:Grey(Frostborn_Taunka_FactionText))
-	ARL_WrathCommon4CB:Disable()
-
-	local ARL_WrathCommon3CB = CreateFrame("CheckButton", "ARL_WrathCommon3CB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_WrathCommon3CB, MainPanel.filter_menu.Rep.LK,sformat(L["SPECIFIC_REP_DESC"], Valiance_Warsong_FactionText), "wrathcommon3", 13, 1, 0)
-	ARL_WrathCommon3CBText:SetText(Valiance_Warsong_FactionText)
-	ARL_WrathCommon3CBText:SetFont(narrowFont, 11)
-	ARL_WrathCommon3CBText:SetText(addon:Grey(Valiance_Warsong_FactionText))
-	ARL_WrathCommon3CB:Disable()
-
-	local ARL_RepWyrmrestCB = CreateFrame("CheckButton", "ARL_RepWyrmrestCB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepWyrmrestCB, MainPanel.filter_menu.Rep.LK,sformat(L["SPECIFIC_REP_DESC"], BFAC["The Wyrmrest Accord"]), "wyrmrest", 14, 1, 0)
-	ARL_RepWyrmrestCBText:SetText(BFAC["The Wyrmrest Accord"])
-	ARL_RepWyrmrestCBText:SetFont(narrowFont, 11)
-
-	local ARL_AshenVerdictCB = CreateFrame("CheckButton", "ARL_RepAshenVerdictCB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_RepAshenVerdictCB, MainPanel.filter_menu.Rep.LK, sformat(L["SPECIFIC_REP_DESC"], BFAC["The Ashen Verdict"]), "ashenverdict", 15, 1, 0)
-	ARL_RepAshenVerdictCBText:SetText(BFAC["The Ashen Verdict"])
-	ARL_RepAshenVerdictCBText:SetFont(narrowFont, 11)
-
-	-------------------------------------------------------------------------------
-	-- Miscellaneous Filter Menu
-	-------------------------------------------------------------------------------
-	MainPanel.filter_menu.Misc = CreateFrame("Frame", "ARL_FilterMenu_Misc", MainPanel.filter_menu)
-	MainPanel.filter_menu.Misc:SetWidth(FILTERMENU_LARGE)
-	MainPanel.filter_menu.Misc:SetHeight(280)
-	MainPanel.filter_menu.Misc:EnableMouse(true)
-	MainPanel.filter_menu.Misc:EnableKeyboard(true)
-	MainPanel.filter_menu.Misc:SetMovable(false)
-	MainPanel.filter_menu.Misc:SetPoint("TOPLEFT", MainPanel.filter_menu, "TOPLEFT", 17, -16)
-	MainPanel.filter_menu.Misc:Hide()
-
-	local ARL_MiscText = MainPanel.filter_menu.Misc:CreateFontString("ARL_MiscText", "OVERLAY", "GameFontHighlight")
-	ARL_MiscText:SetText(_G.MISCELLANEOUS .. ":")
-	ARL_MiscText:SetPoint("TOPLEFT", MainPanel.filter_menu.Misc, "TOPLEFT", 5, -8)
-	ARL_MiscText:SetHeight(14)
-	ARL_MiscText:SetWidth(150)
-	ARL_MiscText:SetJustifyH("LEFT")
-
-	local ARL_IgnoreCB = CreateFrame("CheckButton", "ARL_IgnoreCB", MainPanel.filter_menu.Misc, "UICheckButtonTemplate")
-	Generic_MakeCheckButton(ARL_IgnoreCB, MainPanel.filter_menu.Misc, L["DISPLAY_EXCLUSION_DESC"], 0, 2, 1, 1)
-	ARL_IgnoreCBText:SetText(L["Display Exclusions"])
+					   ReDisplay()
+				   end)

-	local ARL_MiscAltText = MainPanel.filter_menu.Misc:CreateFontString("ARL_MiscAltBtn", "OVERLAY", "GameFontNormal")
-	ARL_MiscAltText:SetText(L["Alt-Tradeskills"] .. ":")
-	ARL_MiscAltText:SetPoint("TOPLEFT", ARL_IgnoreCB, "BOTTOMLEFT", 4, 0)
-	ARL_MiscAltText:SetHeight(14)
-	ARL_MiscAltText:SetWidth(95)
-	ARL_MiscAltText:SetJustifyH("LEFT")
+	local ARL_Weapon1HCB = CreateFrame("CheckButton", "ARL_Weapon1HCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_Weapon1HCB, MainPanel.filter_menu.Item, L["ONEHAND_DESC"], "onehand", 9, 1, 0)
+	ARL_Weapon1HCBText:SetText(L["One Hand"])

-	local ARL_MiscAltBtn = CreateFrame("Button", "ARL_IgnoreCB", MainPanel.filter_menu.Misc)
-	ARL_MiscAltBtn:SetPoint("LEFT", ARL_MiscAltText, "RIGHT")
-	ARL_MiscAltBtn:SetHeight(22)
-	ARL_MiscAltBtn:SetWidth(22)
-	ARL_MiscAltBtn:SetNormalTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Up")
-	ARL_MiscAltBtn:SetPushedTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Down")
-	ARL_MiscAltBtn:SetDisabledTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Disabled")
-	ARL_MiscAltBtn:SetHighlightTexture("Interface\\Buttons\\UI-Common-MouseHilight")
-	SetTooltipScripts(ARL_MiscAltBtn, L["ALT_TRADESKILL_DESC"], 1)
-	ARL_MiscAltBtn:RegisterForClicks("LeftButtonUp")
-	ARL_MiscAltBtn:SetScript("OnClick",
-				 function(this, button)
-					 if clicktip then
-						 if not click_info.modified then
-							 clicktip = QTip:Release(clicktip)
-							 twipe(click_info)
-						 else
-							 twipe(click_info)
-							 GenerateClickableTT(this)
-						 end
-					 else
-						 clicktip = QTip:Acquire("ARL_Clickable", 1, "CENTER")
-						 twipe(click_info)
-						 if TipTac and TipTac.AddModifiedTip then
-							 TipTac:AddModifiedTip(clicktip, true)
-						 end
-						 GenerateClickableTT(this)
-					 end
-				 end)
-	ARL_MiscAltBtn:SetScript("OnHide",
-				 function(this, button)
-					 clicktip = QTip:Release(clicktip)
-					 twipe(click_info)
-				 end)
+	local ARL_Weapon2HCB = CreateFrame("CheckButton", "ARL_Weapon2HCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_Weapon2HCB, MainPanel.filter_menu.Item, L["TWOHAND_DESC"], "twohand", 9, 2, 0)
+	ARL_Weapon2HCBText:SetText(L["Two Hand"])

-	-------------------------------------------------------------------------------
-	-- Now that everything exists, populate the global filter table
-	-------------------------------------------------------------------------------
-	local filterdb = addon.db.profile.filters
+	local ARL_WeaponDaggerCB = CreateFrame("CheckButton", "ARL_WeaponDaggerCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_WeaponDaggerCB, MainPanel.filter_menu.Item, L["DAGGER_DESC"], "dagger", 10, 1, 0)
+	ARL_WeaponDaggerCBText:SetText(L["Dagger"])

-	FilterValueMap = {
-		------------------------------------------------------------------------------------------------
-		-- General Options
-		------------------------------------------------------------------------------------------------
-		["specialty"]		= { cb = ARL_SpecialtyCB,		svroot = filterdb.general },
-		["skill"]		= { cb = ARL_LevelCB,			svroot = filterdb.general },
-		["faction"]		= { cb = ARL_FactionCB,			svroot = filterdb.general },
-		["known"]		= { cb = ARL_KnownCB,			svroot = filterdb.general },
-		["unknown"]		= { cb = ARL_UnknownCB,			svroot = filterdb.general },
-		------------------------------------------------------------------------------------------------
-		-- Classes
-		------------------------------------------------------------------------------------------------
-		["deathknight"]		= { cb = ARL_DeathKnightCB,		svroot = filterdb.classes },
-		["druid"]		= { cb = ARL_DruidCB,			svroot = filterdb.classes },
-		["hunter"]		= { cb = ARL_HunterCB,			svroot = filterdb.classes },
-		["mage"]		= { cb = ARL_MageCB,			svroot = filterdb.classes },
-		["paladin"]		= { cb = ARL_PaladinCB,			svroot = filterdb.classes },
-		["priest"]		= { cb = ARL_PriestCB,			svroot = filterdb.classes },
-		["rogue"]		= { cb = ARL_RogueCB,			svroot = filterdb.classes },
-		["shaman"]		= { cb = ARL_ShamanCB,			svroot = filterdb.classes },
-		["warlock"]		= { cb = ARL_WarlockCB,			svroot = filterdb.classes },
-		["warrior"]		= { cb = ARL_WarriorCB,			svroot = filterdb.classes },
-		------------------------------------------------------------------------------------------------
-		-- Obtain Options
-		------------------------------------------------------------------------------------------------
-		["instance"]		= { cb = ARL_InstanceCB,		svroot = filterdb.obtain },
-		["raid"]		= { cb = ARL_RaidCB,			svroot = filterdb.obtain },
-		["quest"]		= { cb = ARL_QuestCB,			svroot = filterdb.obtain },
-		["seasonal"]		= { cb = ARL_SeasonalCB,		svroot = filterdb.obtain },
-		["trainer"]		= { cb = ARL_TrainerCB,			svroot = filterdb.obtain },
-		["vendor"]		= { cb = ARL_VendorCB,			svroot = filterdb.obtain },
-		["pvp"]			= { cb = ARL_PVPCB,			svroot = filterdb.obtain },
-		["discovery"]		= { cb = ARL_DiscoveryCB,		svroot = filterdb.obtain },
-		["worlddrop"]		= { cb = ARL_WorldDropCB,		svroot = filterdb.obtain },
-		["mobdrop"]		= { cb = ARL_MobDropCB,			svroot = filterdb.obtain },
-		["originalwow"]		= { cb = ARL_OriginalWoWCB,		svroot = filterdb.obtain },
-		["bc"]			= { cb = ARL_BCCB,			svroot = filterdb.obtain },
-		["wrath"]		= { cb = ARL_WrathCB,			svroot = filterdb.obtain },
-		------------------------------------------------------------------------------------------------
-		-- Binding Options
-		------------------------------------------------------------------------------------------------
-		["itemboe"]		= { cb = ARL_iBoECB,			svroot = filterdb.binding },
-		["itembop"]		= { cb = ARL_iBoPCB,			svroot = filterdb.binding },
-		["recipeboe"]		= { cb = ARL_rBoECB,			svroot = filterdb.binding },
-		["recipebop"]		= { cb = ARL_rBoPCB,			svroot = filterdb.binding },
-		------------------------------------------------------------------------------------------------
-		-- Armor Options
-		------------------------------------------------------------------------------------------------
-		["cloth"]		= { cb = ARL_ArmorClothCB,		svroot = filterdb.item.armor },
-		["leather"]		= { cb = ARL_ArmorLeatherCB,		svroot = filterdb.item.armor },
-		["mail"]		= { cb = ARL_ArmorMailCB,		svroot = filterdb.item.armor },
-		["plate"]		= { cb = ARL_ArmorPlateCB,		svroot = filterdb.item.armor },
-		["cloak"]		= { cb = ARL_ArmorCloakCB,		svroot = filterdb.item.armor },
-		["necklace"]		= { cb = ARL_ArmorNecklaceCB,		svroot = filterdb.item.armor },
-		["ring"]		= { cb = ARL_ArmorRingCB,		svroot = filterdb.item.armor },
-		["trinket"]		= { cb = ARL_ArmorTrinketCB,		svroot = filterdb.item.armor },
-		["shield"]		= { cb = ARL_ArmorShieldCB,		svroot = filterdb.item.armor },
-		------------------------------------------------------------------------------------------------
-		-- Weapon Options
-		------------------------------------------------------------------------------------------------
-		["onehand"]		= { cb = ARL_Weapon1HCB,		svroot = filterdb.item.weapon },
-		["twohand"]		= { cb = ARL_Weapon2HCB,		svroot = filterdb.item.weapon },
-		["dagger"]		= { cb = ARL_WeaponDaggerCB,		svroot = filterdb.item.weapon },
-		["axe"]			= { cb = ARL_WeaponAxeCB,		svroot = filterdb.item.weapon },
-		["mace"]		= { cb = ARL_WeaponMaceCB,		svroot = filterdb.item.weapon },
-		["sword"]		= { cb = ARL_WeaponSwordCB,		svroot = filterdb.item.weapon },
-		["polearm"]		= { cb = ARL_WeaponPolearmCB,		svroot = filterdb.item.weapon },
-		["fist"]		= { cb = ARL_WeaponFistCB,		svroot = filterdb.item.weapon },
-		["staff"]		= { cb = ARL_WeaponStaffCB,		svroot = nil },
-		["wand"]		= { cb = ARL_WeaponWandCB,		svroot = filterdb.item.weapon },
-		["thrown"]		= { cb = ARL_WeaponThrownCB,		svroot = filterdb.item.weapon },
-		["bow"]			= { cb = ARL_WeaponBowCB,		svroot = nil },
-		["crossbow"]		= { cb = ARL_WeaponCrossbowCB,		svroot = nil },
-		["ammo"]		= { cb = ARL_WeaponAmmoCB,		svroot = filterdb.item.weapon },
-		["gun"]			= { cb = ARL_WeaponGunCB,		svroot = filterdb.item.weapon },
-		------------------------------------------------------------------------------------------------
-		-- Role Options
-		------------------------------------------------------------------------------------------------
-		["tank"]		= { cb = ARL_PlayerTankCB,		svroot = filterdb.player },
-		["melee"]		= { cb = ARL_PlayerMeleeCB,		svroot = filterdb.player },
-		["healer"]		= { cb = ARL_PlayerHealerCB,		svroot = filterdb.player },
-		["caster"]		= { cb = ARL_PlayerCasterCB,		svroot = filterdb.player },
-		------------------------------------------------------------------------------------------------
-		-- Old World Rep Options
-		------------------------------------------------------------------------------------------------
-		["argentdawn"]		= { cb = ARL_RepArgentDawnCB,		svroot = filterdb.rep },
-		["cenarioncircle"]	= { cb = ARL_RepCenarionCircleCB,	svroot = filterdb.rep },
-		["thoriumbrotherhood"]	= { cb = ARL_RepThoriumCB,		svroot = filterdb.rep },
-		["timbermaw"]		= { cb = ARL_RepTimbermawCB,		svroot = filterdb.rep },
-		["zandalar"]		= { cb = ARL_RepZandalarCB,		svroot = filterdb.rep },
-		------------------------------------------------------------------------------------------------
-		-- BC Rep Options
-		------------------------------------------------------------------------------------------------
-		["aldor"]		= { cb = ARL_RepAldorCB,		svroot = filterdb.rep },
-		["ashtonguedeathsworn"]	= { cb = ARL_RepAshtongueCB,		svroot = filterdb.rep },
-		["cenarionexpedition"]	= { cb = ARL_RepCenarionExpeditionCB,	svroot = filterdb.rep },
-		["consortium"]		= { cb = ARL_RepConsortiumCB,		svroot = filterdb.rep },
-		["hellfire"]		= { cb = ARL_RepHonorHoldCB,		svroot = filterdb.rep },
-		["keepersoftime"]	= { cb = ARL_RepKeepersOfTimeCB,	svroot = filterdb.rep },
-		["nagrand"]		= { cb = ARL_RepKurenaiCB,		svroot = filterdb.rep },
-		["lowercity"]		= { cb = ARL_RepLowerCityCB,		svroot = filterdb.rep },
-		["scaleofthesands"]	= { cb = ARL_RepScaleSandsCB,		svroot = filterdb.rep },
-		["scryer"]		= { cb = ARL_RepScryersCB,		svroot = filterdb.rep },
-		["shatar"]		= { cb = ARL_RepShatarCB,		svroot = filterdb.rep },
-		["shatteredsun"]	= { cb = ARL_RepShatteredSunCB,		svroot = filterdb.rep },
-		["sporeggar"]		= { cb = ARL_RepSporeggarCB,		svroot = filterdb.rep },
-		["violeteye"]		= { cb = ARL_RepVioletEyeCB,		svroot = filterdb.rep },
-		------------------------------------------------------------------------------------------------
-		-- LK Rep Options
-		------------------------------------------------------------------------------------------------
-		["argentcrusade"]	= { cb = ARL_RepArgentCrusadeCB,	svroot = filterdb.rep },
-		["frenzyheart"]		= { cb = ARL_RepFrenzyheartCB,		svroot = filterdb.rep },
-		["ebonblade"]		= { cb = ARL_RepEbonBladeCB,		svroot = filterdb.rep },
-		["kirintor"]		= { cb = ARL_RepKirinTorCB,		svroot = filterdb.rep },
-		["sonsofhodir"]		= { cb = ARL_RepSonsOfHodirCB,		svroot = filterdb.rep },
-		["kaluak"]		= { cb = ARL_RepKaluakCB,		svroot = filterdb.rep },
-		["oracles"]		= { cb = ARL_RepOraclesCB,		svroot = filterdb.rep },
-		["wyrmrest"]		= { cb = ARL_RepWyrmrestCB,		svroot = filterdb.rep },
-		["ashenverdict"]	= { cb = ARL_RepAshenVerdictCB,		svroot = filterdb.rep },
-		["wrathcommon1"]	= { cb = ARL_WrathCommon1CB,		svroot = filterdb.rep },
-		["wrathcommon2"]	= { cb = ARL_WrathCommon2CB,		svroot = nil },
-		["wrathcommon3"]	= { cb = ARL_WrathCommon3CB,		svroot = nil },
-		["wrathcommon4"]	= { cb = ARL_WrathCommon4CB,		svroot = nil },
-		["wrathcommon5"]	= { cb = ARL_WrathCommon5CB,		svroot = nil },
-	}
-end
+	local ARL_WeaponAxeCB = CreateFrame("CheckButton", "ARL_WeaponAxeCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_WeaponAxeCB, MainPanel.filter_menu.Item, L["AXE_DESC"], "axe", 10, 2, 0)
+	ARL_WeaponAxeCBText:SetText(L["Axe"])

--------------------------------------------------------------------------------
--- Displays the main recipe frame.
--------------------------------------------------------------------------------
-function addon:DisplayFrame()
-	MainPanel:SetPosition()
-	MainPanel:SetProfession()
-	MainPanel:UpdateTitle()
-	MainPanel.progress_bar:Update()
-	MainPanel:SetScale(addon.db.profile.frameopts.uiscale)
+	local ARL_WeaponMaceCB = CreateFrame("CheckButton", "ARL_WeaponMaceCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_WeaponMaceCB, MainPanel.filter_menu.Item, L["MACE_DESC"], "mace", 11, 1, 0)
+	ARL_WeaponMaceCBText:SetText(L["Mace"])

-	ARL_DD_Sort.initialize = ARL_DD_Sort_Initialize				-- Initialize dropdown
+	local ARL_WeaponSwordCB = CreateFrame("CheckButton", "ARL_WeaponSwordCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_WeaponSwordCB, MainPanel.filter_menu.Item, L["SWORD_DESC"], "sword", 11, 2, 0)
+	ARL_WeaponSwordCBText:SetText(L["Sword"])

-	SortRecipeList()
+	local ARL_WeaponPolearmCB = CreateFrame("CheckButton", "ARL_WeaponPolearmCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_WeaponPolearmCB, MainPanel.filter_menu.Item, L["POLEARM_DESC"], "polearm", 12, 1, 0)
+	ARL_WeaponPolearmCBText:SetText(L["Polearm"])

-	MainPanel.scroll_frame:Update(false, false)
-	MainPanel:Show()
+	local ARL_WeaponFistCB = CreateFrame("CheckButton", "ARL_WeaponFistCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_WeaponFistCB, MainPanel.filter_menu.Item, L["FIST_DESC"], "fist", 12, 2, 0)
+	ARL_WeaponFistCBText:SetText(L["Fist"])

-	-- Set the search text to the last searched text or the global default string for the search box
-	-- We should think about either preserving the search everytime arl is open or we clear it completely  - pompachomp
-	ARL_SearchText:SetText(ARL_LastSearchedText  or L["SEARCH_BOX_DESC"])
-end
+	local ARL_WeaponStaffCB = CreateFrame("CheckButton", "ARL_WeaponStaffCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_WeaponStaffCB, MainPanel.filter_menu.Item, L["STAFF_DESC"], "staff", 13, 1, 0)
+	ARL_WeaponStaffCBText:SetText(L["Staff"])
+	ARL_WeaponStaffCBText:SetText(addon:Grey(L["Staff"]))
+	ARL_WeaponStaffCB:Disable()

--------------------------------------------------------------------------------
--- Under various conditions, the recipe list will have to be re-displayed.
--- This could happen because a filter changes, a new profession is chosen, or
--- a new search occurred. Use this function to do all the dirty work
---
--- Upvalued at the top of the file.
--------------------------------------------------------------------------------
-function ReDisplay()
-	addon:UpdateFilters()
-	Player:MarkExclusions()
+	local ARL_WeaponWandCB = CreateFrame("CheckButton", "ARL_WeaponWandCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_WeaponWandCB, MainPanel.filter_menu.Item, L["WAND_DESC"], "wand", 13, 2, 0)
+	ARL_WeaponWandCBText:SetText(L["Wand"])

-	SortRecipeList()
-	MainPanel.scroll_frame:Update(false, false)
-	MainPanel.progress_bar:Update()
+	local ARL_WeaponThrownCB = CreateFrame("CheckButton", "ARL_WeaponThrownCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_WeaponThrownCB, MainPanel.filter_menu.Item, L["THROWN_DESC"], "thrown", 14, 1, 0)
+	ARL_WeaponThrownCBText:SetText(L["Thrown"])

-	-- Make sure our expand all button is set to expandall
-	ARL_ExpandButton:SetText(L["EXPANDALL"])
-	SetTooltipScripts(ARL_ExpandButton, L["EXPANDALL_DESC"])
-end
+	local ARL_WeaponBowCB = CreateFrame("CheckButton", "ARL_WeaponBowCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_WeaponBowCB, MainPanel.filter_menu.Item, L["BOW_DESC"], "bow", 14, 2, 0)
+	ARL_WeaponBowCBText:SetText(L["Bow"])
+	ARL_WeaponBowCBText:SetText(addon:Grey(L["Bow"]))
+	ARL_WeaponBowCB:Disable()

--------------------------------------------------------------------------------
--- MainPanel.scrollframe methods and data
--------------------------------------------------------------------------------
-do
-	MainPanel.scroll_frame = CreateFrame("ScrollFrame", "ARL_MainPanelScrollFrame", MainPanel, "FauxScrollFrameTemplate")
-	MainPanel.scroll_frame:SetHeight(322)
-	MainPanel.scroll_frame:SetWidth(243)
-	MainPanel.scroll_frame:SetPoint("TOPLEFT", MainPanel, "TOPLEFT", 20, -97)
-	MainPanel.scroll_frame:SetScript("OnVerticalScroll",
-					 function(self, arg1)
-						 self.scrolling = true
-						 FauxScrollFrame_OnVerticalScroll(self, arg1, 16, self.Update)
-						 self.scrolling = nil
-					 end)
+	local ARL_WeaponCrossbowCB = CreateFrame("CheckButton", "ARL_WeaponCrossbowCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_WeaponCrossbowCB, MainPanel.filter_menu.Item, L["CROSSBOW_DESC"], "crossbow", 15, 1, 0)
+	ARL_WeaponCrossbowCBText:SetText(L["Crossbow"])
+	ARL_WeaponCrossbowCBText:SetText(addon:Grey(L["Crossbow"]))
+	ARL_WeaponCrossbowCB:Disable()

-	MainPanel.scroll_frame.entries = {}
-	MainPanel.scroll_frame.state_buttons = {}
-	MainPanel.scroll_frame.recipe_buttons = {}
+	local ARL_WeaponAmmoCB = CreateFrame("CheckButton", "ARL_WeaponAmmoCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_WeaponAmmoCB, MainPanel.filter_menu.Item, L["AMMO_DESC"], "ammo", 15, 2, 0)
+	ARL_WeaponAmmoCBText:SetText(L["Ammo"])

-	local ScrollFrame = MainPanel.scroll_frame
+	local ARL_WeaponGunCB = CreateFrame("CheckButton", "ARL_WeaponGunCB", MainPanel.filter_menu.Item, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_WeaponGunCB, MainPanel.filter_menu.Item, L["GUN_DESC"], "gun", 16, 1, 0)
+	ARL_WeaponGunCBText:SetText(L["Gun"])

-	local highlight = CreateFrame("Frame", nil, UIParent)
-	highlight:SetFrameStrata("TOOLTIP")
-	highlight:Hide()
+	MainPanel.filter_menu.Player = CreateFrame("Frame", "ARL_FilterMenu_Player", MainPanel.filter_menu)
+	MainPanel.filter_menu.Player:SetWidth(FILTERMENU_SMALL)
+	MainPanel.filter_menu.Player:SetHeight(280)
+	MainPanel.filter_menu.Player:EnableMouse(true)
+	MainPanel.filter_menu.Player:EnableKeyboard(true)
+	MainPanel.filter_menu.Player:SetMovable(false)
+	MainPanel.filter_menu.Player:SetPoint("TOPLEFT", MainPanel.filter_menu, "TOPLEFT", 17, -16)
+	MainPanel.filter_menu.Player:Hide()

-	highlight._texture = highlight:CreateTexture(nil, "OVERLAY")
-	highlight._texture:SetTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight")
-	highlight._texture:SetBlendMode("ADD")
-	highlight._texture:SetAllPoints(highlight)
+	local ARL_PlayerTankCB = CreateFrame("CheckButton", "ARL_PlayerTankCB", MainPanel.filter_menu.Player, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_PlayerTankCB, MainPanel.filter_menu.Player, L["TANKS_DESC"], "tank", 1, 1, 0)
+	ARL_PlayerTankCBText:SetText(_G.TANK)

-	local function Button_OnEnter(self)
-		GenerateTooltipContent(self, ScrollFrame.entries[self.string_index].recipe_id)
-	end
+	local ARL_PlayerMeleeCB = CreateFrame("CheckButton", "ARL_PlayerMeleeCB", MainPanel.filter_menu.Player, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_PlayerMeleeCB, MainPanel.filter_menu.Player, L["MELEE_DPS_DESC"], "melee", 2, 1, 0)
+	ARL_PlayerMeleeCBText:SetText(_G.MELEE)

-	local function Button_OnLeave()
-		QTip:Release(arlTooltip)
-		arlSpellTooltip:Hide()
-	end
+	local ARL_PlayerHealerCB = CreateFrame("CheckButton", "ARL_PlayerHealerCB", MainPanel.filter_menu.Player, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_PlayerHealerCB, MainPanel.filter_menu.Player, L["HEALERS_DESC"], "healer", 3, 1, 0)
+	ARL_PlayerHealerCBText:SetText(_G.HEALER)

-	local function Bar_OnEnter(self)
-		highlight:SetParent(self)
-		highlight:SetAllPoints(self)
-		highlight:Show()
-		GenerateTooltipContent(self, ScrollFrame.entries[self.string_index].recipe_id)
-	end
+	local ARL_PlayerCasterCB = CreateFrame("CheckButton", "ARL_PlayerCasterCB", MainPanel.filter_menu.Player, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_PlayerCasterCB, MainPanel.filter_menu.Player, L["CASTER_DPS_DESC"], "caster", 4, 1, 0)
+	ARL_PlayerCasterCBText:SetText(_G.DAMAGER)

-	local function Bar_OnLeave()
-		highlight:Hide()
-		highlight:ClearAllPoints()
-		highlight:SetParent(nil)
-		QTip:Release(arlTooltip)
-		arlSpellTooltip:Hide()
-	end
+	MainPanel.filter_menu.Rep = CreateFrame("Frame", "ARL_FilterMenu_Rep", MainPanel.filter_menu)
+	MainPanel.filter_menu.Rep:SetWidth(FILTERMENU_SMALL)
+	MainPanel.filter_menu.Rep:SetHeight(280)
+	MainPanel.filter_menu.Rep:EnableMouse(true)
+	MainPanel.filter_menu.Rep:EnableKeyboard(true)
+	MainPanel.filter_menu.Rep:SetMovable(false)
+	MainPanel.filter_menu.Rep:SetPoint("TOPLEFT", MainPanel.filter_menu, "TOPLEFT", 17, -16)
+	MainPanel.filter_menu.Rep:Hide()

-	function ScrollFrame:Update(expand_acquires, refresh)
-		local sorted_recipes = addon.sorted_recipes
-		local recipe_list = addon.recipe_list
-		local exclusions = addon.db.profile.exclusionlist
-		local sort_type = addon.db.profile.sorting
-		local skill_sort = (sort_type == "SkillAsc" or sort_type == "SkillDesc")
-		local insert_index = 1
+	do
+		-- Rep Filtering panel switcher
+		local function RepFilterSwitch(whichrep)
+			-- 1	ARL_Rep_ClassicCB		Old World Rep
+			-- 2	ARL_Rep_BCCB				Burning Crusade
+			-- 3	ARL_Rep_LKCB				Wrath of the Lich King
+			local ShowPanel = false

-		-- If not refreshing an existing list and not scrolling up/down, wipe and re-initialize the entries.
-		if not refresh and not self.scrolling then
-			for i = 1, #self.entries do
-				ReleaseTable(self.entries[i])
+			if whichrep == 1 then
+				if ARL_Rep_ClassicCB:GetChecked() then
+					ShowPanel = true
+					MainPanel.filter_menu.Rep.Classic:Show()
+					MainPanel.filter_menu.Rep.BC:Hide()
+					MainPanel.filter_menu.Rep.LK:Hide()
+					ARL_Rep_BCCB:SetChecked(false)
+					ARL_Rep_LKCB:SetChecked(false)
+				else
+					ShowPanel = false
+				end
+			elseif whichrep == 2 then
+				if ARL_Rep_BCCB:GetChecked() then
+					ShowPanel = true
+					MainPanel.filter_menu.Rep.Classic:Hide()
+					MainPanel.filter_menu.Rep.BC:Show()
+					MainPanel.filter_menu.Rep.LK:Hide()
+					ARL_Rep_ClassicCB:SetChecked(false)
+					ARL_Rep_LKCB:SetChecked(false)
+				else
+					ShowPanel = false
+				end
+			else -- whichrep == 3 (WotLK)
+				if ARL_Rep_LKCB:GetChecked() then
+					ShowPanel = true
+					MainPanel.filter_menu.Rep.Classic:Hide()
+					MainPanel.filter_menu.Rep.BC:Hide()
+					MainPanel.filter_menu.Rep.LK:Show()
+					ARL_Rep_ClassicCB:SetChecked(false)
+					ARL_Rep_BCCB:SetChecked(false)
+				else
+					ShowPanel = false
+				end
 			end
-			twipe(self.entries)
-
-			for i = 1, #sorted_recipes do
-				local recipe_index = sorted_recipes[i]
-				local recipe_entry = recipe_list[recipe_index]
+			local texture = MainPanel.filter_menu.texture
+			texture:ClearAllPoints()

-				if recipe_entry["Display"] and recipe_entry["Search"] then
-					local recipe_string = recipe_entry["Name"]
+			if ShowPanel then
+				MainPanel.filter_menu:SetWidth(FILTERMENU_DOUBLE_WIDTH)

-					if exclusions[recipe_index] then
-						recipe_string = "** " .. recipe_string .. " **"
-					end
-					local recipe_level = recipe_entry["Level"]
+				texture:SetTexture([[Interface\Addons\AckisRecipeList\img\fly_repcol]])
+				texture:SetAllPoints(MainPanel.filter_menu)
+				texture:SetTexCoord(0, (FILTERMENU_DOUBLE_WIDTH/512), 0, (FILTERMENU_HEIGHT/512))

-					recipe_string = skill_sort and ("[" .. recipe_level .. "] - " .. recipe_string) or (recipe_string .. " - [" .. recipe_level .. "]")
+				MainPanel.filter_menu.Rep.Classic:SetPoint("TOPRIGHT", MainPanel.filter_menu, "TOPRIGHT", -7, -14)
+				MainPanel.filter_menu.Rep.BC:SetPoint("TOPRIGHT", MainPanel.filter_menu, "TOPRIGHT", -7, -14)
+				MainPanel.filter_menu.Rep.LK:SetPoint("TOPRIGHT", MainPanel.filter_menu, "TOPRIGHT", -7, -14)
+			else
+				MainPanel.filter_menu:SetWidth(FILTERMENU_SINGLE_WIDTH)

-					local t = AcquireTable()
-					t.text = ColourSkillLevel(recipe_entry, Player:HasProperRepLevel(recipe_index), recipe_string)
+				texture:SetTexture([[Interface\Addons\AckisRecipeList\img\fly_1col]])
+				texture:SetAllPoints(MainPanel.filter_menu)
+				texture:SetTexCoord(0, (FILTERMENU_SINGLE_WIDTH/256), 0, (FILTERMENU_HEIGHT/512))

-					t.recipe_id = recipe_index
-					t.is_header = true
+				MainPanel.filter_menu.Rep.Classic:Hide()
+				MainPanel.filter_menu.Rep.BC:Hide()
+				MainPanel.filter_menu.Rep.LK:Hide()

-					if expand_acquires and recipe_entry["Acquire"] then
-						-- we have acquire information for this. push the title entry into the strings
-						-- and start processing the acquires
-						t.is_expanded = true
-						tinsert(self.entries, insert_index, t)
-						insert_index = self:ExpandEntry(insert_index)
-					else
-						t.is_expanded = false
-						tinsert(self.entries, insert_index, t)
-						insert_index = insert_index + 1
-					end
-				end
+				ARL_Rep_ClassicCB:SetChecked(false)
+				ARL_Rep_BCCB:SetChecked(false)
+				ARL_Rep_LKCB:SetChecked(false)
 			end
 		end

-		-- Reset the current buttons/lines
-		for i = 1, NUM_RECIPE_LINES do
-			local recipe = self.recipe_buttons[i]
-			local state = self.state_buttons[i]
+		ARL_Rep_ClassicCB = CreateFilterMenuButton("ARL_Rep_ClassicCB", "Glues-WoW-Logo", 1)
+		ARL_Rep_ClassicCB:SetPoint("TOPLEFT", MainPanel.filter_menu.Rep, "TOPLEFT", 0, -10)
+		ARL_Rep_ClassicCB:SetScript("OnClick",
+					    function()
+						    RepFilterSwitch(1)
+					    end)

-			recipe.string_index = 0
-			recipe:SetText("")
-			recipe:SetScript("OnEnter", nil)
-			recipe:SetScript("OnLeave", nil)
+		ARL_Rep_BCCB = CreateFilterMenuButton("ARL_Rep_BCCB", "GLUES-WOW-BCLOGO", 1)
+		ARL_Rep_BCCB:SetPoint("TOPLEFT", MainPanel.filter_menu.Rep, "TOPLEFT", 0, -60)
+		ARL_Rep_BCCB:SetScript("OnClick",
+				      function()
+					      RepFilterSwitch(2)
+				      end)

-			state.string_index = 0
-			state:Hide()
-			state:SetScript("OnEnter", nil)
-			state:SetScript("OnLeave", nil)
-		end
-		local num_entries = #self.entries
-		local display_lines = NUM_RECIPE_LINES
+		ARL_Rep_LKCB = CreateFilterMenuButton("ARL_Rep_LKCB", "wotlk_logo", 1)
+		ARL_Rep_LKCB:SetPoint("TOPLEFT", MainPanel.filter_menu.Rep, "TOPLEFT", 0, -110)
+		ARL_Rep_LKCB:SetScript("OnClick",
+				      function()
+					      RepFilterSwitch(3)
+				      end)
+	end
+	-------------------------------------------------------------------------------
+	-- Original Reputations
+	-------------------------------------------------------------------------------
+	MainPanel.filter_menu.Rep.Classic = CreateFrame("Frame", "ARL_FilterMenu_Rep_Classic", MainPanel.filter_menu.Rep)
+	MainPanel.filter_menu.Rep.Classic:SetWidth(150)
+	MainPanel.filter_menu.Rep.Classic:SetHeight(280)
+	MainPanel.filter_menu.Rep.Classic:EnableMouse(true)
+	MainPanel.filter_menu.Rep.Classic:EnableKeyboard(true)
+	MainPanel.filter_menu.Rep.Classic:SetMovable(false)
+	MainPanel.filter_menu.Rep.Classic:SetPoint("TOPRIGHT", MainPanel.filter_menu, "TOPRIGHT", -7, -16)
+	MainPanel.filter_menu.Rep.Classic:Hide()

-		if num_entries < display_lines then
-			display_lines = num_entries / 2
-		end
-		FauxScrollFrame_Update(self, num_entries, display_lines, 16)
-		addon:ClosePopups()
+	local ARL_Rep_ClassicButton = GenericCreateButton("ARL_Rep_ClassicButton", MainPanel.filter_menu.Rep.Classic, 20, 140, "GameFontHighlight", "GameFontHighlightSmall",
+							  _G.REPUTATION .. ":", "LEFT", L["REP_TEXT_DESC"], 0)
+	ARL_Rep_ClassicButton:SetPoint("TOPLEFT", MainPanel.filter_menu.Rep.Classic, "TOPLEFT", -2, -4)

-		if num_entries > 0 then
-			ARL_ExpandButton:SetNormalFontObject("GameFontNormalSmall")
-			ARL_ExpandButton:Enable()
+	ARL_Rep_ClassicButton:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight")
+	ARL_Rep_ClassicButton:RegisterForClicks("LeftButtonUp", "RightButtonUp")
+	ARL_Rep_ClassicButton:SetScript("OnClick",
+				   function(self,button)
+					   local filterdb = addon.db.profile.filters.rep
+					   if button == "LeftButton" then
+						   -- Set all Reputations to true
+						   filterdb.argentdawn = true
+						   filterdb.cenarioncircle = true
+						   filterdb.thoriumbrotherhood = true
+						   filterdb.timbermaw = true
+						   filterdb.zandalar = true
+					   elseif button == "RightButton" then
+						   -- Set all Reputations to false
+						   filterdb.argentdawn = false
+						   filterdb.cenarioncircle = false
+						   filterdb.thoriumbrotherhood = false
+						   filterdb.timbermaw = false
+						   filterdb.zandalar = false
+					   end
+					   -- Update the checkboxes with the new value
+					   ARL_RepArgentDawnCB:SetChecked(filterdb.argentdawn)
+					   ARL_RepCenarionCircleCB:SetChecked(filterdb.cenarioncircle)
+					   ARL_RepThoriumCB:SetChecked(filterdb.thoriumbrotherhood)
+					   ARL_RepTimbermawCB:SetChecked(filterdb.timbermaw)
+					   ARL_RepZandalarCB:SetChecked(filterdb.zandalar)
+					   -- Reset our title
+					   MainPanel:UpdateTitle()
+					   -- Use new filters
+					   ReDisplay()
+				   end)

-			-- Populate the buttons with new values
-			local button_index = 1
-			local string_index = button_index + FauxScrollFrame_GetOffset(self)
-			local stayInLoop = true
+	local ARL_RepArgentDawnCB = CreateFrame("CheckButton", "ARL_RepArgentDawnCB", MainPanel.filter_menu.Rep.Classic, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepArgentDawnCB, MainPanel.filter_menu.Rep.Classic,sformat(L["SPECIFIC_REP_DESC"], BFAC["Argent Dawn"]), "argentdawn", 2, 1, 0)
+	ARL_RepArgentDawnCBText:SetText(BFAC["Argent Dawn"])
+	ARL_RepArgentDawnCBText:SetFont(narrowFont, 11)
+
+	local ARL_RepCenarionCircleCB = CreateFrame("CheckButton", "ARL_RepCenarionCircleCB", MainPanel.filter_menu.Rep.Classic, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepCenarionCircleCB, MainPanel.filter_menu.Rep.Classic,sformat(L["SPECIFIC_REP_DESC"], BFAC["Cenarion Circle"]), "cenarioncircle", 3, 1, 0)
+	ARL_RepCenarionCircleCBText:SetText(BFAC["Cenarion Circle"])
+	ARL_RepCenarionCircleCBText:SetFont(narrowFont, 11)

-			while stayInLoop do
-				local cur_state = self.state_buttons[button_index]
-				local cur_entry = self.entries[string_index]
+	local ARL_RepThoriumCB = CreateFrame("CheckButton", "ARL_RepThoriumCB", MainPanel.filter_menu.Rep.Classic, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepThoriumCB, MainPanel.filter_menu.Rep.Classic,sformat(L["SPECIFIC_REP_DESC"], BFAC["Thorium Brotherhood"]), "thoriumbrotherhood", 4, 1, 0)
+	ARL_RepThoriumCBText:SetText(BFAC["Thorium Brotherhood"])
+	ARL_RepThoriumCBText:SetFont(narrowFont, 11)

-				if cur_entry.is_header then
-					cur_state:Show()
+	local ARL_RepTimbermawCB = CreateFrame("CheckButton", "ARL_RepTimbermawCB", MainPanel.filter_menu.Rep.Classic, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepTimbermawCB, MainPanel.filter_menu.Rep.Classic,sformat(L["SPECIFIC_REP_DESC"], BFAC["Timbermaw Hold"]), "timbermaw", 5, 1, 0)
+	ARL_RepTimbermawCBText:SetText(BFAC["Timbermaw Hold"])
+	ARL_RepTimbermawCBText:SetFont(narrowFont, 11)

-					if cur_entry.is_expanded then
-						cur_state:SetNormalTexture("Interface\\Buttons\\UI-MinusButton-Up")
-						cur_state:SetPushedTexture("Interface\\Buttons\\UI-MinusButton-Down")
-						cur_state:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight")
-						cur_state:SetDisabledTexture("Interface\\Buttons\\UI-MinusButton-Disabled")
-					else
-						cur_state:SetNormalTexture("Interface\\Buttons\\UI-PlusButton-Up")
-						cur_state:SetPushedTexture("Interface\\Buttons\\UI-PlusButton-Down")
-						cur_state:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight")
-						cur_state:SetDisabledTexture("Interface\\Buttons\\UI-PlusButton-Disabled")
-					end
-					cur_state.string_index = string_index
-					cur_state:SetScript("OnEnter", Button_OnEnter)
-					cur_state:SetScript("OnLeave", Button_OnLeave)
-				else
-					cur_state:Hide()
-				end
-				local cur_recipe = self.recipe_buttons[button_index]
+	local ARL_RepZandalarCB = CreateFrame("CheckButton", "ARL_RepZandalarCB", MainPanel.filter_menu.Rep.Classic, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepZandalarCB, MainPanel.filter_menu.Rep.Classic,sformat(L["SPECIFIC_REP_DESC"], BFAC["Zandalar Tribe"]), "zandalar", 6, 1, 0)
+	ARL_RepZandalarCBText:SetText(BFAC["Zandalar Tribe"])
+	ARL_RepZandalarCBText:SetFont(narrowFont, 11)

-				cur_recipe.string_index = string_index
-				cur_recipe:SetText(cur_entry.text)
-				cur_recipe:SetScript("OnEnter", Bar_OnEnter)
-				cur_recipe:SetScript("OnLeave", Bar_OnLeave)
+	-------------------------------------------------------------------------------
+	-- The Burning Crusade Reputations
+	-------------------------------------------------------------------------------
+	MainPanel.filter_menu.Rep.BC = CreateFrame("Frame", "ARL_FilterMenu_Rep_BC", MainPanel.filter_menu.Rep)
+	MainPanel.filter_menu.Rep.BC:SetWidth(150)
+	MainPanel.filter_menu.Rep.BC:SetHeight(280)
+	MainPanel.filter_menu.Rep.BC:EnableMouse(true)
+	MainPanel.filter_menu.Rep.BC:EnableKeyboard(true)
+	MainPanel.filter_menu.Rep.BC:SetMovable(false)
+	MainPanel.filter_menu.Rep.BC:SetPoint("TOPRIGHT", MainPanel.filter_menu, "TOPRIGHT", -7, -16)
+	MainPanel.filter_menu.Rep.BC:Hide()

-				button_index = button_index + 1
-				string_index = string_index + 1
+	local ARL_Rep_BCButton = GenericCreateButton("ARL_Rep_ClassicButton", MainPanel.filter_menu.Rep.BC, 20, 140, "GameFontHighlight", "GameFontHighlightSmall",
+						     _G.REPUTATION .. ":", "LEFT", L["REP_TEXT_DESC"], 0)
+	ARL_Rep_BCButton:SetPoint("TOPLEFT", MainPanel.filter_menu.Rep.BC, "TOPLEFT", -2, -4)

-				if (button_index > NUM_RECIPE_LINES) or (string_index > num_entries) then
-					stayInLoop = false
-				end
-			end
-		else
-			-- disable expand button, it's useless here and would spam the same error again
-			ARL_ExpandButton:SetNormalFontObject("GameFontDisableSmall")
-			ARL_ExpandButton:Disable()
+	ARL_Rep_BCButton:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight")
+	ARL_Rep_BCButton:RegisterForClicks("LeftButtonUp", "RightButtonUp")
+	ARL_Rep_BCButton:SetScript("OnClick",
+				   function(self,button)
+					   local filterdb = addon.db.profile.filters.rep
+					   if button == "LeftButton" then
+						   -- Set all Reputations to true
+						   filterdb.aldor = true
+						   filterdb.ashtonguedeathsworn = true
+						   filterdb.cenarionexpedition = true
+						   filterdb.consortium = true
+						   filterdb.hellfire = true
+						   filterdb.keepersoftime = true
+						   filterdb.nagrand = true
+						   filterdb.lowercity = true
+						   filterdb.scaleofthesands = true
+						   filterdb.scryer = true
+						   filterdb.shatar = true
+						   filterdb.shatteredsun = true
+						   filterdb.sporeggar = true
+						   filterdb.violeteye = true
+					   elseif button == "RightButton" then
+						   -- Set all Reputations to false
+						   filterdb.aldor = false
+						   filterdb.ashtonguedeathsworn = false
+						   filterdb.cenarionexpedition = false
+						   filterdb.consortium = false
+						   filterdb.hellfire = false
+						   filterdb.keepersoftime = false
+						   filterdb.nagrand = false
+						   filterdb.lowercity = false
+						   filterdb.scaleofthesands = false
+						   filterdb.scryer = false
+						   filterdb.shatar = false
+						   filterdb.shatteredsun = false
+						   filterdb.sporeggar = false
+						   filterdb.violeteye = false
+					   end
+					   -- Update the checkboxes with the new value
+					   ARL_RepAldorCB:SetChecked(filterdb.aldor)
+					   ARL_RepAshtongueCB:SetChecked(filterdb.ashtonguedeathsworn)
+					   ARL_RepCenarionExpeditionCB:SetChecked(filterdb.cenarionexpedition)
+					   ARL_RepConsortiumCB:SetChecked(filterdb.consortium)
+					   ARL_RepHonorHoldCB:SetChecked(filterdb.hellfire)
+					   ARL_RepKeepersOfTimeCB:SetChecked(filterdb.keepersoftime)
+					   ARL_RepKurenaiCB:SetChecked(filterdb.nagrand)
+					   ARL_RepLowerCityCB:SetChecked(filterdb.lowercity)
+					   ARL_RepScaleSandsCB:SetChecked(filterdb.scaleofthesands)
+					   ARL_RepScryersCB:SetChecked(filterdb.scryer)
+					   ARL_RepShatarCB:SetChecked(filterdb.shatar)
+					   ARL_RepShatteredSunCB:SetChecked(filterdb.shatteredsun)
+					   ARL_RepSporeggarCB:SetChecked(filterdb.sporeggar)
+					   ARL_RepVioletEyeCB:SetChecked(filterdb.violeteye)
+					   -- Reset our title
+					   MainPanel:UpdateTitle()
+					   -- Use new filters
+					   ReDisplay()
+				   end)

-			local showpopup = false
+	local ARL_RepAldorCB = CreateFrame("CheckButton", "ARL_RepAldorCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepAldorCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], BFAC["The Aldor"]), "aldor", 2, 1, 0)
+	ARL_RepAldorCBText:SetText(BFAC["The Aldor"])
+	ARL_RepAldorCBText:SetFont(narrowFont, 11)

-			if not addon.db.profile.hidepopup then
-				showpopup = true
-			end
+	local ARL_RepAshtongueCB = CreateFrame("CheckButton", "ARL_RepAshtongueCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepAshtongueCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], BFAC["Ashtongue Deathsworn"]), "ashtonguedeathsworn", 3, 1, 0)
+	ARL_RepAshtongueCBText:SetText(BFAC["Ashtongue Deathsworn"])
+	ARL_RepAshtongueCBText:SetFont(narrowFont, 11)

-			-- If we haven't run this before we'll show pop-ups for the first time.
-			if addon.db.profile.addonversion ~= addon.version then
-				addon.db.profile.addonversion = addon.version
-				showpopup = true
-			end
+	local ARL_RepCenarionExpeditionCB = CreateFrame("CheckButton", "ARL_RepCenarionExpeditionCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepCenarionExpeditionCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], BFAC["Cenarion Expedition"]), "cenarionexpedition", 4, 1, 0)
+	ARL_RepCenarionExpeditionCBText:SetText(BFAC["Cenarion Expedition"])
+	ARL_RepCenarionExpeditionCBText:SetFont(narrowFont, 11)

-			if Player.recipes_total == 0 then
-				if showpopup then
-					StaticPopup_Show("ARL_NOTSCANNED")
-				end
-			elseif Player.recipes_known == Player.recipes_total then
-				if showpopup then
-					StaticPopup_Show("ARL_ALLKNOWN")
-				end
-			elseif (Player.recipes_total_filtered - Player.recipes_known_filtered) == 0 then
-				if showpopup then
-					StaticPopup_Show("ARL_ALLFILTERED")
-				end
-			elseif Player.excluded_recipes_unknown ~= 0 then
-				if showpopup then
-					StaticPopup_Show("ARL_ALLEXCLUDED")
-				end
-			elseif ARL_SearchText:GetText() ~= "" then
-				StaticPopup_Show("ARL_SEARCHFILTERED")
-			else
-				addon:Print(L["NO_DISPLAY"])
-				addon:Print("DEBUG: recipes_total check for 0")
-				addon:Print("DEBUG: recipes_total: " .. Player.recipes_total)
-				addon:Print("DEBUG: recipes_total check for equal to recipes_total")
-				addon:Print("DEBUG: recipes_known: " .. Player.recipes_known)
-				addon:Print("DEBUG: recipes_total: " .. Player.recipes_total)
-				addon:Print("DEBUG: recipes_total_filtered - recipes_known_filtered = 0")
-				addon:Print("DEBUG: recipes_total_filtered: " .. Player.recipes_total_filtered)
-				addon:Print("DEBUG: recipes_known_filtered: " .. Player.recipes_known_filtered)
-				addon:Print("DEBUG: excluded_recipes_unknown ~= 0")
-				addon:Print("DEBUG: excluded_recipes_unknown: " .. Player.excluded_recipes_unknown)
-			end
-		end
-	end
-	local faction_strings
+	local ARL_RepConsortiumCB = CreateFrame("CheckButton", "ARL_RepConsortiumCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepConsortiumCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], BFAC["The Consortium"]), "consortium", 5, 1, 0)
+	ARL_RepConsortiumCBText:SetText(BFAC["The Consortium"])
+	ARL_RepConsortiumCBText:SetFont(narrowFont, 11)

-	local function CheckDisplayFaction(faction)
-		if addon.db.profile.filters.general.faction then
-			return true
-		end
-		return (not faction or faction == BFAC[Player["Faction"]] or faction == FACTION_NEUTRAL)
-	end
+	local ARL_RepHonorHoldCB = CreateFrame("CheckButton", "ARL_RepHonorHoldCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepHonorHoldCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], HonorHold_Thrallmar_FactionText), "hellfire", 6, 1, 0)
+	ARL_RepHonorHoldCBText:SetText(HonorHold_Thrallmar_FactionText)
+	ARL_RepHonorHoldCBText:SetFont(narrowFont, 11)

-	function ScrollFrame:ExpandEntry(entry_index)
-		local obtain_filters = addon.db.profile.filters.obtain
-		local recipe_id = self.entries[entry_index].recipe_id
-		local pad = "  "
+	local ARL_RepKeepersOfTimeCB = CreateFrame("CheckButton", "ARL_RepKeepersOfTimeCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepKeepersOfTimeCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], BFAC["Keepers of Time"]), "keepersoftime", 7, 1, 0)
+	ARL_RepKeepersOfTimeCBText:SetText(BFAC["Keepers of Time"])
+	ARL_RepKeepersOfTimeCBText:SetFont(narrowFont, 11)

-		-- entry_index is the position in self.entries that we want
-		-- to expand. Since we are expanding the current entry, the return
-		-- value should be the index of the next button after the expansion
-		-- occurs
-		entry_index = entry_index + 1
+	local ARL_RepKurenaiCB = CreateFrame("CheckButton", "ARL_RepKurenaiCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepKurenaiCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], Kurenai_Maghar_FactionText), "nagrand", 8, 1, 0)
+	ARL_RepKurenaiCBText:SetText(Kurenai_Maghar_FactionText)
+	ARL_RepKurenaiCBText:SetFont(narrowFont, 11)

-		for k, v in pairs(addon.recipe_list[recipe_id]["Acquire"]) do
-			-- Initialize the first line here, since every type below will have one.
-			local acquire_type = v["Type"]
-			local t = AcquireTable()
-			t.recipe_id = recipe_id
-			t.is_expanded = true
+	local ARL_RepLowerCityCB = CreateFrame("CheckButton", "ARL_RepLowerCityCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepLowerCityCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], BFAC["Lower City"]), "lowercity", 9, 1, 0)
+	ARL_RepLowerCityCBText:SetText(BFAC["Lower City"])
+	ARL_RepLowerCityCBText:SetFont(narrowFont, 11)

-			if acquire_type == A_TRAINER and obtain_filters.trainer then
-				local trainer = addon.trainer_list[v["ID"]]
+	local ARL_RepScaleSandsCB = CreateFrame("CheckButton", "ARL_RepScaleSandsCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepScaleSandsCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], BFAC["The Scale of the Sands"]), "scaleofthesands", 10, 1, 0)
+	ARL_RepScaleSandsCBText:SetText(BFAC["The Scale of the Sands"])
+	ARL_RepScaleSandsCBText:SetFont(narrowFont, 11)

-				if CheckDisplayFaction(trainer["Faction"]) then
-					local nStr = ""
+	local ARL_RepScryersCB = CreateFrame("CheckButton", "ARL_RepScryersCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepScryersCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], BFAC["The Scryers"]), "scryer", 11, 1, 0)
+	ARL_RepScryersCBText:SetText(BFAC["The Scryers"])
+	ARL_RepScryersCBText:SetFont(narrowFont, 11)

-					if trainer["Faction"] == FACTION_HORDE then
-						nStr = addon:Horde(trainer["Name"])
-					elseif (trainer["Faction"] == FACTION_ALLIANCE) then
-						nStr = addon:Alliance(trainer["Name"])
-					else
-						nStr = addon:Neutral(trainer["Name"])
-					end
-					t.text = pad .. addon:Trainer(L["Trainer"] .. " : ") .. nStr
+	local ARL_RepShatarCB = CreateFrame("CheckButton", "ARL_RepShatarCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepShatarCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], BFAC["The Sha'tar"]), "shatar", 12, 1, 0)
+	ARL_RepShatarCBText:SetText(BFAC["The Sha'tar"])
+	ARL_RepShatarCBText:SetFont(narrowFont, 11)

-					tinsert(self.entries, entry_index, t)
-					entry_index = entry_index + 1
+	local ARL_RepShatteredSunCB = CreateFrame("CheckButton", "ARL_RepShatteredSunCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepShatteredSunCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], BFAC["Shattered Sun Offensive"]), "shatteredsun", 13, 1, 0)
+	ARL_RepShatteredSunCBText:SetText(BFAC["Shattered Sun Offensive"])
+	ARL_RepShatteredSunCBText:SetFont(narrowFont, 11)

-					local cStr = ""
+	local ARL_RepSporeggarCB = CreateFrame("CheckButton", "ARL_RepSporeggarCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepSporeggarCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], BFAC["Sporeggar"]), "sporeggar", 14, 1, 0)
+	ARL_RepSporeggarCBText:SetText(BFAC["Sporeggar"])
+	ARL_RepSporeggarCBText:SetFont(narrowFont, 11)
+
+	local ARL_RepVioletEyeCB = CreateFrame("CheckButton", "ARL_RepVioletEyeCB", MainPanel.filter_menu.Rep.BC, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepVioletEyeCB, MainPanel.filter_menu.Rep.BC,sformat(L["SPECIFIC_REP_DESC"], BFAC["The Violet Eye"]), "violeteye", 15, 1, 0)
+	ARL_RepVioletEyeCBText:SetText(BFAC["The Violet Eye"])
+	ARL_RepVioletEyeCBText:SetFont(narrowFont, 11)

-					if (trainer["Coordx"] ~= 0) and (trainer["Coordy"] ~= 0) then
-						cStr = addon:Coords("(" .. trainer["Coordx"] .. ", " .. trainer["Coordy"] .. ")")
-					end
-					t = AcquireTable()
-					t.recipe_id = recipe_id
-					t.is_expanded = true
-					t.text = pad .. pad .. trainer["Location"] .. " " .. cStr
+	-------------------------------------------------------------------------------
+	-- Wrath of the Lich King Reputations
+	-------------------------------------------------------------------------------
+	MainPanel.filter_menu.Rep.LK = CreateFrame("Frame", "ARL_FilterMenu_Rep_LK", MainPanel.filter_menu.Rep)
+	MainPanel.filter_menu.Rep.LK:SetWidth(150)
+	MainPanel.filter_menu.Rep.LK:SetHeight(280)
+	MainPanel.filter_menu.Rep.LK:EnableMouse(true)
+	MainPanel.filter_menu.Rep.LK:EnableKeyboard(true)
+	MainPanel.filter_menu.Rep.LK:SetMovable(false)
+	MainPanel.filter_menu.Rep.LK:SetPoint("TOPRIGHT", MainPanel.filter_menu, "TOPRIGHT", -7, -16)
+	MainPanel.filter_menu.Rep.LK:Hide()

-					tinsert(self.entries, entry_index, t)
-					entry_index = entry_index + 1
-				end
-				-- Right now PVP obtained items are located on vendors so they have the vendor and pvp flag.
-				-- We need to display the vendor in the drop down if we want to see vendors or if we want to see PVP
-				-- This allows us to select PVP only and to see just the PVP recipes
-			elseif acquire_type == A_VENDOR and (obtain_filters.vendor or obtain_filters.pvp) then
-				local vendor = addon.vendor_list[v["ID"]]
+	local ARL_Rep_LKButton = GenericCreateButton("ARL_Rep_ClassicButton", MainPanel.filter_menu.Rep.LK, 20, 140, "GameFontHighlight", "GameFontHighlightSmall",
+						     _G.REPUTATION .. ":", "LEFT", L["REP_TEXT_DESC"], 0)
+	ARL_Rep_LKButton:SetPoint("TOPLEFT", MainPanel.filter_menu.Rep.LK, "TOPLEFT", -2, -4)

-				if CheckDisplayFaction(vendor["Faction"]) then
-					local nStr = ""
+	ARL_Rep_LKButton:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight")
+	ARL_Rep_LKButton:RegisterForClicks("LeftButtonUp", "RightButtonUp")
+	ARL_Rep_LKButton:SetScript("OnClick",
+				   function(self,button)
+					   local filterdb = addon.db.profile.filters.rep
+					   if button == "LeftButton" then
+						   -- Set all Reputations to true
+						   filterdb.argentcrusade = true
+						   filterdb.frenzyheart = true
+						   filterdb.ebonblade = true
+						   filterdb.kirintor = true
+						   filterdb.sonsofhodir = true
+						   filterdb.kaluak = true
+						   filterdb.oracles = true
+						   filterdb.wyrmrest = true
+						   filterdb.ashenverdict = true
+						   filterdb.wrathcommon1 = true
+					   elseif button == "RightButton" then
+						   -- Set all Reputations to false
+						   filterdb.argentcrusade = false
+						   filterdb.frenzyheart = false
+						   filterdb.ebonblade = false
+						   filterdb.kirintor = false
+						   filterdb.sonsofhodir = false
+						   filterdb.kaluak = false
+						   filterdb.oracles = false
+						   filterdb.wyrmrest = false
+						   filterdb.ashenverdict = false
+						   filterdb.wrathcommon1 = false
+					   end
+					   -- Update the checkboxes with the new value
+					   ARL_RepArgentCrusadeCB:SetChecked(filterdb.argentcrusade)
+					   ARL_RepFrenzyheartCB:SetChecked(filterdb.frenzyheart)
+					   ARL_RepEbonBladeCB:SetChecked(filterdb.ebonblade)
+					   ARL_RepKirinTorCB:SetChecked(filterdb.kirintor)
+					   ARL_RepSonsOfHodirCB:SetChecked(filterdb.sonsofhodir)
+					   ARL_RepKaluakCB:SetChecked(filterdb.kaluak)
+					   ARL_RepOraclesCB:SetChecked(filterdb.oracles)
+					   ARL_RepWyrmrestCB:SetChecked(filterdb.wyrmrest)
+					   ARL_RepAshenVerdictCB:SetChecked(filterdb.ashenverdict)
+					   ARL_WrathCommon1CB:SetChecked(filterdb.wrathcommon1)
+					   -- Reset our title
+					   MainPanel:UpdateTitle()
+					   -- Use new filters
+					   ReDisplay()
+				   end)

-					if (vendor["Faction"] == FACTION_HORDE) then
-						nStr = addon:Horde(vendor["Name"])
-					elseif (vendor["Faction"] == FACTION_ALLIANCE) then
-						nStr = addon:Alliance(vendor["Name"])
-					else
-						nStr = addon:Neutral(vendor["Name"])
-					end
-					t.text = pad .. addon:Vendor(L["Vendor"] .. " : ") .. nStr
+	local ARL_WrathCommon1CB = CreateFrame("CheckButton", "ARL_WrathCommon1CB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_WrathCommon1CB, MainPanel.filter_menu.Rep.LK,sformat(L["SPECIFIC_REP_DESC"],  Vanguard_Expedition_FactionText), "wrathcommon1", 2, 1, 0)
+	ARL_WrathCommon1CBText:SetText(Vanguard_Expedition_FactionText)
+	ARL_WrathCommon1CBText:SetFont(narrowFont, 11)

-					tinsert(self.entries, entry_index, t)
-					entry_index = entry_index + 1
+	local ARL_RepArgentCrusadeCB = CreateFrame("CheckButton", "ARL_RepArgentCrusadeCB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepArgentCrusadeCB, MainPanel.filter_menu.Rep.LK,sformat(L["SPECIFIC_REP_DESC"], BFAC["Argent Crusade"]), "argentcrusade", 3, 1, 0)
+	ARL_RepArgentCrusadeCBText:SetText(BFAC["Argent Crusade"])
+	ARL_RepArgentCrusadeCBText:SetFont(narrowFont, 11)

-					local cStr = ""
+	local ARL_WrathCommon5CB = CreateFrame("CheckButton", "ARL_WrathCommon5CB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_WrathCommon5CB, MainPanel.filter_menu.Rep.LK,sformat(L["SPECIFIC_REP_DESC"], Explorer_Hand_FactionText), "wrathcommon5", 4, 1, 0)
+	ARL_WrathCommon5CBText:SetText(Explorer_Hand_FactionText)
+	ARL_WrathCommon5CBText:SetFont(narrowFont, 11)
+	ARL_WrathCommon5CBText:SetText(addon:Grey(Explorer_Hand_FactionText))
+	ARL_WrathCommon5CB:Disable()

-					if (vendor["Coordx"] ~= 0) and (vendor["Coordy"] ~= 0) then
-						cStr = addon:Coords("(" .. vendor["Coordx"] .. ", " .. vendor["Coordy"] .. ")")
-					end
-					t = AcquireTable()
-					t.recipe_id = recipe_id
-					t.is_expanded = true
-					t.text = pad .. pad .. vendor["Location"] .. " " .. cStr
+	local ARL_RepFrenzyheartCB = CreateFrame("CheckButton", "ARL_RepFrenzyheartCB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepFrenzyheartCB, MainPanel.filter_menu.Rep.LK,sformat(L["SPECIFIC_REP_DESC"], BFAC["Frenzyheart Tribe"]), "frenzyheart", 5, 1, 0)
+	ARL_RepFrenzyheartCBText:SetText(BFAC["Frenzyheart Tribe"])
+	ARL_RepFrenzyheartCBText:SetFont(narrowFont, 11)

-					tinsert(self.entries, entry_index, t)
-					entry_index = entry_index + 1
-				end
-				-- Mobs can be in instances, raids, or specific mob related drops.
-			elseif acquire_type == A_MOB and (obtain_filters.mobdrop or obtain_filters.instance or obtain_filters.raid) then
-				local mob = addon.mob_list[v["ID"]]
-				t.text = pad .. addon:MobDrop(L["Mob Drop"] .. " : ") .. addon:Red(mob["Name"])
+	local ARL_RepKaluakCB = CreateFrame("CheckButton", "ARL_RepKaluakCB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepKaluakCB, MainPanel.filter_menu.Rep.LK,sformat(L["SPECIFIC_REP_DESC"], BFAC["The Kalu'ak"]), "kaluak", 6, 1, 0)
+	ARL_RepKaluakCBText:SetText(BFAC["The Kalu'ak"])
+	ARL_RepKaluakCBText:SetFont(narrowFont, 11)

-				tinsert(self.entries, entry_index, t)
-				entry_index = entry_index + 1
+	local ARL_RepKirinTorCB = CreateFrame("CheckButton", "ARL_RepKirinTorCB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepKirinTorCB, MainPanel.filter_menu.Rep.LK,sformat(L["SPECIFIC_REP_DESC"], BFAC["Kirin Tor"]), "kirintor", 7, 1, 0)
+	ARL_RepKirinTorCBText:SetText(BFAC["Kirin Tor"])
+	ARL_RepKirinTorCBText:SetFont(narrowFont, 11)

-				local cStr = ""
+	local ARL_RepEbonBladeCB = CreateFrame("CheckButton", "ARL_RepEbonBladeCB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepEbonBladeCB, MainPanel.filter_menu.Rep.LK,sformat(L["SPECIFIC_REP_DESC"], BFAC["Knights of the Ebon Blade"]), "ebonblade", 8, 1, 0)
+	ARL_RepEbonBladeCBText:SetText(BFAC["Knights of the Ebon Blade"])
+	ARL_RepEbonBladeCBText:SetFont(narrowFont, 11)

-				if (mob["Coordx"] ~= 0) and (mob["Coordy"] ~= 0) then
-					cStr = addon:Coords("(" .. mob["Coordx"] .. ", " .. mob["Coordy"] .. ")")
-				end
-				t = AcquireTable()
-				t.recipe_id = recipe_id
-				t.is_expanded = true
-				t.text = pad .. pad .. mob["Location"] .. " " .. cStr
+	local ARL_RepOraclesCB = CreateFrame("CheckButton", "ARL_RepOraclesCB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepOraclesCB, MainPanel.filter_menu.Rep.LK,sformat(L["SPECIFIC_REP_DESC"], BFAC["The Oracles"]), "oracles", 9, 1, 0)
+	ARL_RepOraclesCBText:SetText(BFAC["The Oracles"])
+	ARL_RepOraclesCBText:SetFont(narrowFont, 11)

-				tinsert(self.entries, entry_index, t)
-				entry_index = entry_index + 1
-			elseif acquire_type == A_QUEST and obtain_filters.quest then
-				local quest = addon.quest_list[v["ID"]]
+	local ARL_WrathCommon2CB = CreateFrame("CheckButton", "ARL_WrathCommon2CB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_WrathCommon2CB, MainPanel.filter_menu.Rep.LK,sformat(L["SPECIFIC_REP_DESC"], SilverConv_Sunreaver_FactionText), "wrathcommon2", 10, 1, 0)
+	ARL_WrathCommon2CBText:SetText(SilverConv_Sunreaver_FactionText)
+	ARL_WrathCommon2CBText:SetFont(narrowFont, 11)
+	ARL_WrathCommon2CBText:SetText(addon:Grey(SilverConv_Sunreaver_FactionText))
+	ARL_WrathCommon2CB:Disable()

-				if CheckDisplayFaction(quest["Faction"]) then
-					local nStr = ""
+	local ARL_RepSonsOfHodirCB = CreateFrame("CheckButton", "ARL_RepSonsOfHodirCB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepSonsOfHodirCB, MainPanel.filter_menu.Rep.LK,sformat(L["SPECIFIC_REP_DESC"], BFAC["The Sons of Hodir"]), "sonsofhodir", 11, 1, 0)
+	ARL_RepSonsOfHodirCBText:SetText(BFAC["The Sons of Hodir"])
+	ARL_RepSonsOfHodirCBText:SetFont(narrowFont, 11)

-					if (quest["Faction"] == FACTION_HORDE) then
-						nStr = addon:Horde(quest["Name"])
-					elseif (quest["Faction"] == FACTION_ALLIANCE) then
-						nStr = addon:Alliance(quest["Name"])
-					else
-						nStr = addon:Neutral(quest["Name"])
-					end
-					t.text = pad .. addon:Quest(L["Quest"] .. " : ") .. nStr
+	local ARL_WrathCommon4CB = CreateFrame("CheckButton", "ARL_WrathCommon4CB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_WrathCommon4CB, MainPanel.filter_menu.Rep.LK,sformat(L["SPECIFIC_REP_DESC"], Frostborn_Taunka_FactionText), "wrathcommon4", 12, 1, 0)
+	ARL_WrathCommon4CBText:SetText(Frostborn_Taunka_FactionText)
+	ARL_WrathCommon4CBText:SetFont(narrowFont, 11)
+	ARL_WrathCommon4CBText:SetText(addon:Grey(Frostborn_Taunka_FactionText))
+	ARL_WrathCommon4CB:Disable()

-					tinsert(self.entries, entry_index, t)
-					entry_index = entry_index + 1
+	local ARL_WrathCommon3CB = CreateFrame("CheckButton", "ARL_WrathCommon3CB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_WrathCommon3CB, MainPanel.filter_menu.Rep.LK,sformat(L["SPECIFIC_REP_DESC"], Valiance_Warsong_FactionText), "wrathcommon3", 13, 1, 0)
+	ARL_WrathCommon3CBText:SetText(Valiance_Warsong_FactionText)
+	ARL_WrathCommon3CBText:SetFont(narrowFont, 11)
+	ARL_WrathCommon3CBText:SetText(addon:Grey(Valiance_Warsong_FactionText))
+	ARL_WrathCommon3CB:Disable()

-					local cStr = ""
+	local ARL_RepWyrmrestCB = CreateFrame("CheckButton", "ARL_RepWyrmrestCB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepWyrmrestCB, MainPanel.filter_menu.Rep.LK,sformat(L["SPECIFIC_REP_DESC"], BFAC["The Wyrmrest Accord"]), "wyrmrest", 14, 1, 0)
+	ARL_RepWyrmrestCBText:SetText(BFAC["The Wyrmrest Accord"])
+	ARL_RepWyrmrestCBText:SetFont(narrowFont, 11)

-					if (quest["Coordx"] ~= 0) and (quest["Coordy"] ~= 0) then
-						cStr = addon:Coords("(" .. quest["Coordx"] .. ", " .. quest["Coordy"] .. ")")
-					end
-					t = AcquireTable()
-					t.recipe_id = recipe_id
-					t.is_expanded = true
-					t.text = pad .. pad .. quest["Location"] .. " " .. cStr
+	local ARL_AshenVerdictCB = CreateFrame("CheckButton", "ARL_RepAshenVerdictCB", MainPanel.filter_menu.Rep.LK, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_RepAshenVerdictCB, MainPanel.filter_menu.Rep.LK, sformat(L["SPECIFIC_REP_DESC"], BFAC["The Ashen Verdict"]), "ashenverdict", 15, 1, 0)
+	ARL_RepAshenVerdictCBText:SetText(BFAC["The Ashen Verdict"])
+	ARL_RepAshenVerdictCBText:SetFont(narrowFont, 11)

-					tinsert(self.entries, entry_index, t)
-					entry_index = entry_index + 1
-				end
-			elseif acquire_type == A_SEASONAL and obtain_filters.seasonal then
-				t.text = pad .. addon:Season(SEASONAL_CATEGORY .. " : " .. addon.seasonal_list[v["ID"]]["Name"])
-				tinsert(self.entries, entry_index, t)
-				entry_index = entry_index + 1
-			elseif acquire_type == A_REPUTATION then -- Need to check if we're displaying the currently id'd rep or not as well
-				-- Reputation Obtain
-				-- Rep: ID, Faction
-				-- RepLevel = 0 (Neutral), 1 (Friendly), 2 (Honored), 3 (Revered), 4 (Exalted)
-				-- RepVendor - VendorID
-				local rep_vendor = addon.vendor_list[v["RepVendor"]]
+	-------------------------------------------------------------------------------
+	-- Miscellaneous Filter Menu
+	-------------------------------------------------------------------------------
+	MainPanel.filter_menu.Misc = CreateFrame("Frame", "ARL_FilterMenu_Misc", MainPanel.filter_menu)
+	MainPanel.filter_menu.Misc:SetWidth(FILTERMENU_LARGE)
+	MainPanel.filter_menu.Misc:SetHeight(280)
+	MainPanel.filter_menu.Misc:EnableMouse(true)
+	MainPanel.filter_menu.Misc:EnableKeyboard(true)
+	MainPanel.filter_menu.Misc:SetMovable(false)
+	MainPanel.filter_menu.Misc:SetPoint("TOPLEFT", MainPanel.filter_menu, "TOPLEFT", 17, -16)
+	MainPanel.filter_menu.Misc:Hide()

-				if CheckDisplayFaction(rep_vendor["Faction"]) then
-					t.text = pad .. addon:Rep(_G.REPUTATION .. " : ") .. addon.reputation_list[v["ID"]]["Name"]
-					tinsert(self.entries, entry_index, t)
-					entry_index = entry_index + 1
+	local ARL_MiscText = MainPanel.filter_menu.Misc:CreateFontString("ARL_MiscText", "OVERLAY", "GameFontHighlight")
+	ARL_MiscText:SetText(_G.MISCELLANEOUS .. ":")
+	ARL_MiscText:SetPoint("TOPLEFT", MainPanel.filter_menu.Misc, "TOPLEFT", 5, -8)
+	ARL_MiscText:SetHeight(14)
+	ARL_MiscText:SetWidth(150)
+	ARL_MiscText:SetJustifyH("LEFT")

-					if not faction_strings then
-						faction_strings = {
-							[0] = addon:Neutral(FACTION_NEUTRAL .. " : "),
-							[1] = addon:Friendly(BFAC["Friendly"] .. " : "),
-							[2] = addon:Honored(BFAC["Honored"] .. " : "),
-							[3] = addon:Revered(BFAC["Revered"] .. " : "),
-							[4] = addon:Exalted(BFAC["Exalted"] .. " : ")
-						}
-					end
-					local nStr = ""
+	local ARL_IgnoreCB = CreateFrame("CheckButton", "ARL_IgnoreCB", MainPanel.filter_menu.Misc, "UICheckButtonTemplate")
+	Generic_MakeCheckButton(ARL_IgnoreCB, MainPanel.filter_menu.Misc, L["DISPLAY_EXCLUSION_DESC"], 0, 2, 1, 1)
+	ARL_IgnoreCBText:SetText(L["Display Exclusions"])

-					if rep_vendor["Faction"] == FACTION_HORDE then
-						nStr = addon:Horde(rep_vendor["Name"])
-					elseif rep_vendor["Faction"] == FACTION_ALLIANCE then
-						nStr = addon:Alliance(rep_vendor["Name"])
-					else
-						nStr = addon:Neutral(rep_vendor["Name"])
-					end
-					t = AcquireTable()
-					t.recipe_id = recipe_id
-					t.is_expanded = true
+	local ARL_MiscAltText = MainPanel.filter_menu.Misc:CreateFontString("ARL_MiscAltBtn", "OVERLAY", "GameFontNormal")
+	ARL_MiscAltText:SetText(L["Alt-Tradeskills"] .. ":")
+	ARL_MiscAltText:SetPoint("TOPLEFT", ARL_IgnoreCB, "BOTTOMLEFT", 4, 0)
+	ARL_MiscAltText:SetHeight(14)
+	ARL_MiscAltText:SetWidth(95)
+	ARL_MiscAltText:SetJustifyH("LEFT")

-					t.text = pad .. pad .. faction_strings[v["RepLevel"]] .. nStr
+	local ARL_MiscAltBtn = CreateFrame("Button", "ARL_IgnoreCB", MainPanel.filter_menu.Misc)
+	ARL_MiscAltBtn:SetPoint("LEFT", ARL_MiscAltText, "RIGHT")
+	ARL_MiscAltBtn:SetHeight(22)
+	ARL_MiscAltBtn:SetWidth(22)
+	ARL_MiscAltBtn:SetNormalTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Up")
+	ARL_MiscAltBtn:SetPushedTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Down")
+	ARL_MiscAltBtn:SetDisabledTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Disabled")
+	ARL_MiscAltBtn:SetHighlightTexture("Interface\\Buttons\\UI-Common-MouseHilight")
+	SetTooltipScripts(ARL_MiscAltBtn, L["ALT_TRADESKILL_DESC"], 1)
+	ARL_MiscAltBtn:RegisterForClicks("LeftButtonUp")
+	ARL_MiscAltBtn:SetScript("OnClick",
+				 function(this, button)
+					 if clicktip then
+						 if not click_info.modified then
+							 clicktip = QTip:Release(clicktip)
+							 twipe(click_info)
+						 else
+							 twipe(click_info)
+							 GenerateClickableTT(this)
+						 end
+					 else
+						 clicktip = QTip:Acquire("ARL_Clickable", 1, "CENTER")
+						 twipe(click_info)
+						 if TipTac and TipTac.AddModifiedTip then
+							 TipTac:AddModifiedTip(clicktip, true)
+						 end
+						 GenerateClickableTT(this)
+					 end
+				 end)
+	ARL_MiscAltBtn:SetScript("OnHide",
+				 function(this, button)
+					 clicktip = QTip:Release(clicktip)
+					 twipe(click_info)
+				 end)

-					tinsert(self.entries, entry_index, t)
-					entry_index = entry_index + 1
+	-------------------------------------------------------------------------------
+	-- Now that everything exists, populate the global filter table
+	-------------------------------------------------------------------------------
+	local filterdb = addon.db.profile.filters

-					local cStr = ""
+	FilterValueMap = {
+		------------------------------------------------------------------------------------------------
+		-- General Options
+		------------------------------------------------------------------------------------------------
+		["specialty"]		= { cb = ARL_SpecialtyCB,		svroot = filterdb.general },
+		["skill"]		= { cb = ARL_LevelCB,			svroot = filterdb.general },
+		["faction"]		= { cb = ARL_FactionCB,			svroot = filterdb.general },
+		["known"]		= { cb = ARL_KnownCB,			svroot = filterdb.general },
+		["unknown"]		= { cb = ARL_UnknownCB,			svroot = filterdb.general },
+		------------------------------------------------------------------------------------------------
+		-- Classes
+		------------------------------------------------------------------------------------------------
+		["deathknight"]		= { cb = ARL_DeathKnightCB,		svroot = filterdb.classes },
+		["druid"]		= { cb = ARL_DruidCB,			svroot = filterdb.classes },
+		["hunter"]		= { cb = ARL_HunterCB,			svroot = filterdb.classes },
+		["mage"]		= { cb = ARL_MageCB,			svroot = filterdb.classes },
+		["paladin"]		= { cb = ARL_PaladinCB,			svroot = filterdb.classes },
+		["priest"]		= { cb = ARL_PriestCB,			svroot = filterdb.classes },
+		["rogue"]		= { cb = ARL_RogueCB,			svroot = filterdb.classes },
+		["shaman"]		= { cb = ARL_ShamanCB,			svroot = filterdb.classes },
+		["warlock"]		= { cb = ARL_WarlockCB,			svroot = filterdb.classes },
+		["warrior"]		= { cb = ARL_WarriorCB,			svroot = filterdb.classes },
+		------------------------------------------------------------------------------------------------
+		-- Obtain Options
+		------------------------------------------------------------------------------------------------
+		["instance"]		= { cb = ARL_InstanceCB,		svroot = filterdb.obtain },
+		["raid"]		= { cb = ARL_RaidCB,			svroot = filterdb.obtain },
+		["quest"]		= { cb = ARL_QuestCB,			svroot = filterdb.obtain },
+		["seasonal"]		= { cb = ARL_SeasonalCB,		svroot = filterdb.obtain },
+		["trainer"]		= { cb = ARL_TrainerCB,			svroot = filterdb.obtain },
+		["vendor"]		= { cb = ARL_VendorCB,			svroot = filterdb.obtain },
+		["pvp"]			= { cb = ARL_PVPCB,			svroot = filterdb.obtain },
+		["discovery"]		= { cb = ARL_DiscoveryCB,		svroot = filterdb.obtain },
+		["worlddrop"]		= { cb = ARL_WorldDropCB,		svroot = filterdb.obtain },
+		["mobdrop"]		= { cb = ARL_MobDropCB,			svroot = filterdb.obtain },
+		["originalwow"]		= { cb = ARL_OriginalWoWCB,		svroot = filterdb.obtain },
+		["bc"]			= { cb = ARL_BCCB,			svroot = filterdb.obtain },
+		["wrath"]		= { cb = ARL_WrathCB,			svroot = filterdb.obtain },
+		------------------------------------------------------------------------------------------------
+		-- Binding Options
+		------------------------------------------------------------------------------------------------
+		["itemboe"]		= { cb = ARL_iBoECB,			svroot = filterdb.binding },
+		["itembop"]		= { cb = ARL_iBoPCB,			svroot = filterdb.binding },
+		["recipeboe"]		= { cb = ARL_rBoECB,			svroot = filterdb.binding },
+		["recipebop"]		= { cb = ARL_rBoPCB,			svroot = filterdb.binding },
+		------------------------------------------------------------------------------------------------
+		-- Armor Options
+		------------------------------------------------------------------------------------------------
+		["cloth"]		= { cb = ARL_ArmorClothCB,		svroot = filterdb.item.armor },
+		["leather"]		= { cb = ARL_ArmorLeatherCB,		svroot = filterdb.item.armor },
+		["mail"]		= { cb = ARL_ArmorMailCB,		svroot = filterdb.item.armor },
+		["plate"]		= { cb = ARL_ArmorPlateCB,		svroot = filterdb.item.armor },
+		["cloak"]		= { cb = ARL_ArmorCloakCB,		svroot = filterdb.item.armor },
+		["necklace"]		= { cb = ARL_ArmorNecklaceCB,		svroot = filterdb.item.armor },
+		["ring"]		= { cb = ARL_ArmorRingCB,		svroot = filterdb.item.armor },
+		["trinket"]		= { cb = ARL_ArmorTrinketCB,		svroot = filterdb.item.armor },
+		["shield"]		= { cb = ARL_ArmorShieldCB,		svroot = filterdb.item.armor },
+		------------------------------------------------------------------------------------------------
+		-- Weapon Options
+		------------------------------------------------------------------------------------------------
+		["onehand"]		= { cb = ARL_Weapon1HCB,		svroot = filterdb.item.weapon },
+		["twohand"]		= { cb = ARL_Weapon2HCB,		svroot = filterdb.item.weapon },
+		["dagger"]		= { cb = ARL_WeaponDaggerCB,		svroot = filterdb.item.weapon },
+		["axe"]			= { cb = ARL_WeaponAxeCB,		svroot = filterdb.item.weapon },
+		["mace"]		= { cb = ARL_WeaponMaceCB,		svroot = filterdb.item.weapon },
+		["sword"]		= { cb = ARL_WeaponSwordCB,		svroot = filterdb.item.weapon },
+		["polearm"]		= { cb = ARL_WeaponPolearmCB,		svroot = filterdb.item.weapon },
+		["fist"]		= { cb = ARL_WeaponFistCB,		svroot = filterdb.item.weapon },
+		["staff"]		= { cb = ARL_WeaponStaffCB,		svroot = nil },
+		["wand"]		= { cb = ARL_WeaponWandCB,		svroot = filterdb.item.weapon },
+		["thrown"]		= { cb = ARL_WeaponThrownCB,		svroot = filterdb.item.weapon },
+		["bow"]			= { cb = ARL_WeaponBowCB,		svroot = nil },
+		["crossbow"]		= { cb = ARL_WeaponCrossbowCB,		svroot = nil },
+		["ammo"]		= { cb = ARL_WeaponAmmoCB,		svroot = filterdb.item.weapon },
+		["gun"]			= { cb = ARL_WeaponGunCB,		svroot = filterdb.item.weapon },
+		------------------------------------------------------------------------------------------------
+		-- Role Options
+		------------------------------------------------------------------------------------------------
+		["tank"]		= { cb = ARL_PlayerTankCB,		svroot = filterdb.player },
+		["melee"]		= { cb = ARL_PlayerMeleeCB,		svroot = filterdb.player },
+		["healer"]		= { cb = ARL_PlayerHealerCB,		svroot = filterdb.player },
+		["caster"]		= { cb = ARL_PlayerCasterCB,		svroot = filterdb.player },
+		------------------------------------------------------------------------------------------------
+		-- Old World Rep Options
+		------------------------------------------------------------------------------------------------
+		["argentdawn"]		= { cb = ARL_RepArgentDawnCB,		svroot = filterdb.rep },
+		["cenarioncircle"]	= { cb = ARL_RepCenarionCircleCB,	svroot = filterdb.rep },
+		["thoriumbrotherhood"]	= { cb = ARL_RepThoriumCB,		svroot = filterdb.rep },
+		["timbermaw"]		= { cb = ARL_RepTimbermawCB,		svroot = filterdb.rep },
+		["zandalar"]		= { cb = ARL_RepZandalarCB,		svroot = filterdb.rep },
+		------------------------------------------------------------------------------------------------
+		-- BC Rep Options
+		------------------------------------------------------------------------------------------------
+		["aldor"]		= { cb = ARL_RepAldorCB,		svroot = filterdb.rep },
+		["ashtonguedeathsworn"]	= { cb = ARL_RepAshtongueCB,		svroot = filterdb.rep },
+		["cenarionexpedition"]	= { cb = ARL_RepCenarionExpeditionCB,	svroot = filterdb.rep },
+		["consortium"]		= { cb = ARL_RepConsortiumCB,		svroot = filterdb.rep },
+		["hellfire"]		= { cb = ARL_RepHonorHoldCB,		svroot = filterdb.rep },
+		["keepersoftime"]	= { cb = ARL_RepKeepersOfTimeCB,	svroot = filterdb.rep },
+		["nagrand"]		= { cb = ARL_RepKurenaiCB,		svroot = filterdb.rep },
+		["lowercity"]		= { cb = ARL_RepLowerCityCB,		svroot = filterdb.rep },
+		["scaleofthesands"]	= { cb = ARL_RepScaleSandsCB,		svroot = filterdb.rep },
+		["scryer"]		= { cb = ARL_RepScryersCB,		svroot = filterdb.rep },
+		["shatar"]		= { cb = ARL_RepShatarCB,		svroot = filterdb.rep },
+		["shatteredsun"]	= { cb = ARL_RepShatteredSunCB,		svroot = filterdb.rep },
+		["sporeggar"]		= { cb = ARL_RepSporeggarCB,		svroot = filterdb.rep },
+		["violeteye"]		= { cb = ARL_RepVioletEyeCB,		svroot = filterdb.rep },
+		------------------------------------------------------------------------------------------------
+		-- LK Rep Options
+		------------------------------------------------------------------------------------------------
+		["argentcrusade"]	= { cb = ARL_RepArgentCrusadeCB,	svroot = filterdb.rep },
+		["frenzyheart"]		= { cb = ARL_RepFrenzyheartCB,		svroot = filterdb.rep },
+		["ebonblade"]		= { cb = ARL_RepEbonBladeCB,		svroot = filterdb.rep },
+		["kirintor"]		= { cb = ARL_RepKirinTorCB,		svroot = filterdb.rep },
+		["sonsofhodir"]		= { cb = ARL_RepSonsOfHodirCB,		svroot = filterdb.rep },
+		["kaluak"]		= { cb = ARL_RepKaluakCB,		svroot = filterdb.rep },
+		["oracles"]		= { cb = ARL_RepOraclesCB,		svroot = filterdb.rep },
+		["wyrmrest"]		= { cb = ARL_RepWyrmrestCB,		svroot = filterdb.rep },
+		["ashenverdict"]	= { cb = ARL_RepAshenVerdictCB,		svroot = filterdb.rep },
+		["wrathcommon1"]	= { cb = ARL_WrathCommon1CB,		svroot = filterdb.rep },
+		["wrathcommon2"]	= { cb = ARL_WrathCommon2CB,		svroot = nil },
+		["wrathcommon3"]	= { cb = ARL_WrathCommon3CB,		svroot = nil },
+		["wrathcommon4"]	= { cb = ARL_WrathCommon4CB,		svroot = nil },
+		["wrathcommon5"]	= { cb = ARL_WrathCommon5CB,		svroot = nil },
+	}
+end

-					if rep_vendor["Coordx"] ~= 0 and rep_vendor["Coordy"] ~= 0 then
-						cStr = addon:Coords("(" .. rep_vendor["Coordx"] .. ", " .. rep_vendor["Coordy"] .. ")")
-					end
-					t = AcquireTable()
-					t.recipe_id = recipe_id
-					t.is_expanded = true
-					t.text = pad .. pad .. pad .. rep_vendor["Location"] .. " " .. cStr
+-------------------------------------------------------------------------------
+-- Displays the main recipe frame.
+-------------------------------------------------------------------------------
+function addon:DisplayFrame()
+	MainPanel:SetPosition()
+	MainPanel:SetProfession()
+	MainPanel:SetScale(addon.db.profile.frameopts.uiscale)

-					tinsert(self.entries, entry_index, t)
-					entry_index = entry_index + 1
-				end
-			elseif acquire_type == A_WORLD_DROP and obtain_filters.worlddrop then
-				t.text = pad .. addon:RarityColor(v["ID"] + 1, L["World Drop"])
-				tinsert(self.entries, entry_index, t)
-				entry_index = entry_index + 1
-			elseif acquire_type == A_CUSTOM then
-				t.text = pad .. addon:Normal(addon.custom_list[v["ID"]]["Name"])
-				tinsert(self.entries, entry_index, t)
-				entry_index = entry_index + 1
-			elseif acquire_type == A_PVP and obtain_filters.pvp then
-				local vendor = addon.vendor_list[v["ID"]]
+	ARL_DD_Sort.initialize = ARL_DD_Sort_Initialize				-- Initialize dropdown

-				if CheckDisplayFaction(vendor["Faction"]) then
-					local cStr = ""
+	SortRecipeList()

-					if vendor["Coordx"] ~= 0 and vendor["Coordy"] ~= 0 then
-						cStr = addon:Coords("(" .. vendor["Coordx"] .. ", " .. vendor["Coordy"] .. ")")
-					end
-					local nStr = ""
+	MainPanel:UpdateTitle()
+	MainPanel.scroll_frame:Update(false, false)
+	MainPanel.progress_bar:Update()
+	MainPanel:Show()

-					if vendor["Faction"] == FACTION_HORDE then
-						nStr = addon:Horde(vendor["Name"])
-					elseif vendor["Faction"] == FACTION_ALLIANCE then
-						nStr = addon:Alliance(vendor["Name"])
-					else
-						nStr = addon:Neutral(vendor["Name"])
-					end
-					t.text = pad .. addon:Vendor(L["Vendor"] .. " : ") .. nStr
+	-- Set the search text to the last searched text or the global default string for the search box
+	-- We should think about either preserving the search everytime arl is open or we clear it completely  - pompachomp
+	ARL_SearchText:SetText(ARL_LastSearchedText  or L["SEARCH_BOX_DESC"])
+end

-					tinsert(self.entries, entry_index, t)
-					entry_index = entry_index + 1
+-------------------------------------------------------------------------------
+-- Under various conditions, the recipe list will have to be re-displayed.
+-- This could happen because a filter changes, a new profession is chosen, or
+-- a new search occurred. Use this function to do all the dirty work
+--
+-- Upvalued at the top of the file.
+-------------------------------------------------------------------------------
+function ReDisplay()
+	addon:UpdateFilters()
+	Player:MarkExclusions()

-					t = AcquireTable()
-					t.recipe_id = recipe_id
-					t.is_expanded = true
-					t.text = pad .. pad .. vendor["Location"] .. " " .. cStr
+	SortRecipeList()
+	MainPanel.scroll_frame:Update(false, false)
+	MainPanel.progress_bar:Update()

-					tinsert(self.entries, entry_index, t)
-					entry_index = entry_index + 1
-				end
-				--@alpha@
-			elseif acquire_type > A_MAX then
-				t.text = "Unhandled Acquire Case - Type: " .. acquire_type
-				tinsert(self.entries, entry_index, t)
-				entry_index = entry_index + 1
-				--@end-alpha@
-			end
-		end
-		return entry_index
-	end
-end	-- do
+	-- Make sure our expand all button is set to expandall
+	ARL_ExpandButton:SetText(L["EXPANDALL"])
+	SetTooltipScripts(ARL_ExpandButton, L["EXPANDALL_DESC"])
+end

 -------------------------------------------------------------------------------
 --- Creates a new frame with the contents of a text dump so you can copy and paste
@@ -4419,8 +4418,15 @@ do
 	copy_frame:SetBackdrop({
 				       bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]],
 				       edgeFile = [[Interface\DialogFrame\UI-DialogBox-Border]],
-				       tile = true, tileSize = 16, edgeSize = 16,
-				       insets = { left = 3, right = 3, top = 5, bottom = 3 }
+				       tile = true,
+				       tileSize = 16,
+				       edgeSize = 16,
+				       insets = {
+					       left = 3,
+					       right = 3,
+					       top = 5,
+					       bottom = 3
+				       }
 			       })
 	copy_frame:SetBackdropColor(0, 0, 0, 1)
 	copy_frame:SetWidth(750)