local _G = getfenv(0)

function Skinner:Outfitter()
	if not self.db.profile.CharacterFrames then return end

	self:Hook("Outfitter_ShowPanel", function(tabId)
		-- self:Debug("Outfitter_ShowPanel: [%s]", tabId)
		self.hooks.Outfitter_ShowPanel(tabId)
		for i = 1, OutfitterFrame.numTabs do
			if i == tabId then
				self:setActiveTab(_G["OutfitterFrameTab"..i])
			else
				self:setInactiveTab(_G["OutfitterFrameTab"..i])
			end
		end
		end)

	self:moveObject(OutfitterButton, "+", 33, "+", 7)
	
	self:keepRegions(OutfitterFrame, {3}) -- N.B. region 3 is text
	self:moveObject(OutfitterFrame, "+", 28, nil, nil)
	self:moveObject(OutfitterCloseButton, "-", 4, "-", 4)
	self:applySkin(OutfitterFrame)
	
	self:keepRegions(OutfitterMainFrame, {2, 3}) -- N.B. region 2 is text, 3 is icon
	self:removeRegions(OutfitterMainFrameScrollbarTrench)
	self:removeRegions(OutfitterMainFrameScrollFrame)
	self:skinScrollBar(OutfitterMainFrameScrollFrame)
	
	--	Outfitter Tabs
	for i = 1, OutfitterFrame.numTabs do

    	local tabName = _G["OutfitterFrameTab"..i]
		self:keepRegions(tabName, {7, 8}) -- N.B. region 7 is the Text, 8 is the highlight
		-- nil out the OnShow script to stop the tabs being resized
		tabName:SetScript("OnShow", nil)
		tabName:SetWidth(tabName:GetTextWidth() + 30)
		_G[tabName:GetName().."HighlightTexture"]:SetWidth(tabName:GetTextWidth() + 30)


        if self.db.profile.TexturedTab then self:applySkin(tabName, nil, 0, 1)
		else self:applySkin(tabName) end
	
		if i == 1 then
			self:moveObject(tabName, "-", 0, "+", 4)
			self:setActiveTab(tabName)
		else
			self:moveObject(tabName, "-", 10, nil, nil)
			self:setInactiveTab(tabName)
		end
		
	end
	
	-- New Outfit
	self:keepRegions(OutfitterNameOutfitDialog, {11}) -- N.B. regions 2 & 3 are text
	self:moveObject(OutfitterNameOutfitDialogTitle, nil, nil, "_", 6)
	self:removeRegions(OutfitterNameOutfitDialogCreateUsing, {1, 2, 3}) -- N.B. region 4 is text
	self:applySkin(OutfitterNameOutfitDialog)
		
end
