
function Nurfed_Options_OnLoad()
	this:SetBackdropBorderColor(0,0,0);
	this:SetBackdropColor(0,0,0);
	UIPanelWindows[this:GetName()] = {area = "center", pushable = 1};
end

function Nurfed_Options_OnShow()
	local func = getglobal(this:GetName().."_OnShow");
	func();

	local button1 = getglobal(this:GetName().."Button1");
	button1:SetText(CLOSE);
	button1:Show();
	button1:ClearAllPoints();
	button1:SetPoint("TOPLEFT", this:GetName().."Frame", "BOTTOMLEFT", 0, 0);
	
	local button2 = getglobal(this:GetName().."Button2");
	button2:SetText(RESET);
	button2:Show();
	button2:ClearAllPoints();
	button2:SetPoint("TOPRIGHT", this:GetName().."Frame", "BOTTOMRIGHT", 0, 0);

	if (this.tabbed) then
		local func = getglobal(this:GetName().."_TabOnClick");
		if (func) then
			func();
		end
		return;
	end

	local index = 1;
	local check = getglobal(this:GetName().."FrameCheck"..index);
	while(check) do
		check:Show();
		index = index + 1;
		check = getglobal(this:GetName().."FrameCheck"..index);
	end

	index = 1;
	local slider = getglobal(this:GetName().."FrameSlider"..index);
	while(slider) do
		slider:Show();
		index = index + 1;
		slider = getglobal(this:GetName().."FrameSlider"..index);
	end

	index = 1;
	local swatch = getglobal(this:GetName().."FrameSwatch"..index);
	while(swatch) do
		swatch:Show();
		index = index + 1;
		swatch = getglobal(this:GetName().."FrameSwatch"..index);
	end

	index = 1;
	local input = getglobal(this:GetName().."FrameInput"..index);
	while(input) do
		input:Show();
		index = index + 1;
		input = getglobal(this:GetName().."FrameInput"..index);
	end
end

function Nurfed_OptionsFrame_OnLoad()
	this:SetBackdropBorderColor(1,1,1);
	this:SetBackdropColor(0.3,0.3,0.3);
	local func = getglobal(this:GetParent():GetName().."Init");
	if (func) then
		func();
	end
end

function Nurfed_OpenColorPicker()
	CloseMenus();
	ColorPickerFrame.func = this.swatchFunc;
	ColorPickerFrame.hasOpacity = this.hasOpacity;
	ColorPickerFrame.opacityFunc = this.opacityFunc;
	ColorPickerFrame.opacity = this.opacity;
	ColorPickerFrame:SetColorRGB(this.r, this.g, this.b);
	ColorPickerFrame.previousValues = {r = this.r, g = this.g, b = this.b, a = this.opacity};
	ColorPickerFrame.cancelFunc = this.cancelFunc;
	ColorPickerFrame:Show();
end