local _, L = ... -- Gain access to the localization table

function VipQuesterOptions_OK()
	VipQuesterOptionsArray["Recolor"]=VipQuesterOptionsCBRecolor:GetChecked() or 0
	VipQuesterOptionsArray["Prices"]=VipQuesterOptionsCBPrices:GetChecked() or 0
	VipQuesterOptionsArray["HighlightHighestVendorPrice"]=VipQuesterOptionsCBHighlightHighestVendorPrice:GetChecked() or 0
	VipQuesterOptionsArray["LootValue"]=VipQuesterOptionsCBLootValue:GetChecked() or 0
	VipQuester_ResetFonts()
end

function VipQuesterOptions_Default()
	VipQuesterOptionsArray["Recolor"]=1
	VipQuesterOptionsArray["Prices"]=1
	VipQuesterOptionsArray["HighlightHighestVendorPrice"]=1
	VipQuesterOptionsArray["LootValue"]=0
end

function VipQuesterOptions_Refresh()
	VipQuesterOptionsCBRecolor:SetChecked(VipQuesterOptionsArray["Recolor"])
	VipQuesterOptionsCBPrices:SetChecked(VipQuesterOptionsArray["Prices"])
	VipQuesterOptionsCBHighlightHighestVendorPrice:SetChecked(VipQuesterOptionsArray["HighlightHighestVendorPrice"])
	VipQuesterOptionsCBLootValue:SetChecked(VipQuesterOptionsArray["LootValue"])
end

function VipQuesterOptions_OnLoad(panel)
	panel:Hide()
	panel.name="VipQuester r"..GetAddOnMetadata("VipQuester", "Version")
	panel.okay=function (self) VipQuesterOptions_OK() end
	panel.default=function (self) VipQuesterOptions_Default() end
	panel.refresh=function (self) VipQuesterOptions_Refresh() end
	VipQuesterOptionsCBRecolorText:SetText(L["\"Recolor\" quest rewards"])
	VipQuesterOptionsCBPricesText:SetText(L["Put prices on quest rewards"])
	VipQuesterOptionsCBHighlightHighestVendorPriceText:SetText(L["Highlight the reward with highest vendor price"])
	VipQuesterOptionsCBLootValueText:SetText(L["Append loot values to the chatmessages when looting"])
	InterfaceOptions_AddCategory(panel)
end
