tinsert(UISpecialFrames, "CT_RA_ChangelogFrame");
CT_RACHANGES_HEIGHT = 500;
function CT_RAChanges_DisplayDialog()
	CT_RA_ChangelogFrame:SetHeight(CT_RACHANGES_HEIGHT+25);
	-- Initialize dialog
		-- Set title
	CT_RA_ChangelogFrameTitle:SetText(CT_RA_Changes["title"]);
	
		-- Show sections
	local section, totalHeight = 1, 0;
	while ( CT_RA_Changes["section" .. section] ) do
		local objSection = getglobal("CT_RA_ChangelogFrameScrollFrameSection" .. section);
		local part, partHeights = 1, 0;
		
			-- Show section
		objSection:Show();
		
			-- Set section title
		getglobal(objSection:GetName() .. "Title"):SetText(CT_RA_Changes["section" .. section]["title"]);
		
			-- Show parts
		while ( CT_RA_Changes["section" .. section][part] ) do
			local objPart = getglobal("CT_RA_ChangelogFrameScrollFrameSection" .. section .. "Part" .. part);
			
				-- Show part
			objPart:Show();
			
				-- Set part stuff
			getglobal(objPart:GetName() .. "Text"):SetText(CT_RA_Changes["section" .. section][part][2]);
			getglobal(objPart:GetName() .. "Text"):SetHeight(CT_RA_Changes["section" .. section][part][1]);
			objPart:SetHeight(CT_RA_Changes["section" .. section][part][1]);
			partHeights = partHeights + CT_RA_Changes["section" .. section][part][1];
			part = part + 1;
		end
		local addedHeight = ( CT_RA_Changes["section" .. section]["addedHeight"] or 0);
		objSection:SetHeight(partHeights+35+addedHeight);
		totalHeight = totalHeight + partHeights+35+addedHeight;
		section = section + 1;
	end
	CT_RA_ChangelogFrameScrollFrameSection:SetHeight(totalHeight);
	ShowUIPanel(CT_RA_ChangelogFrame);
	CT_RA_ChangelogFrameScrollFrame:UpdateScrollChildRect();
	local minVal, maxVal = CT_RA_ChangelogFrameScrollFrameScrollBar:GetMinMaxValues();
	if ( maxVal == 0 ) then
		CT_RA_ChangelogFrameScrollFrameScrollBar:Hide();
	else
		CT_RA_ChangelogFrameScrollFrameScrollBar:Show();
	end
	CT_RA_ChangelogFrameScrollFrame:SetHeight(CT_RACHANGES_HEIGHT-75);
end

-- Add slash command
CT_RA_RegisterSlashCmd("/ralog", CT_RA_CMD_RALOG, 15, "RALOG", CT_RAChanges_DisplayDialog, "/ralog");

CT_RA_Changes = {
	["title"] = "CT_RaidAssist v1.5!",
	
	["section1"] = {
		["title"] = CT_RA_CHG_GENERAL,
		{ 60, CT_RA_CHG1_1 },
		{ 90, CT_RA_CHG1_2 },
		{ 60, CT_RA_CHG1_3 }
	},
	["section2"] = {
		["title"] = CT_RA_CHG_MAJOR,
		["addedHeight"] = 30,
		{ 175, CT_RA_CHG2_1 },
		{ 45, CT_RA_CHG2_2 },
		{ 30, CT_RA_CHG2_3 },
		{ 45, CT_RA_CHG2_4 },
		{ 45, CT_RA_CHG2_5 },
		{ 30, CT_RA_CHG2_6 },
		{ 30, CT_RA_CHG2_7 },
		{ 30, CT_RA_CHG2_8 }
	},
	["section3"] = {
		["title"] = CT_RA_CHG_MINOR,
		["addedHeight"] = 25,
		{ 75, CT_RA_CHG3_1 },
		{ 45, CT_RA_CHG3_2 },
		{ 60, CT_RA_CHG3_3 },
		{ 30, CT_RA_CHG3_4 },
		{ 30, CT_RA_CHG3_5 },
		{ 45, CT_RA_CHG3_6 },
		{ 30, CT_RA_CHG3_7 },
		{ 15, CT_RA_CHG3_8 }
	},
	["section4"] = {
		["title"] = CT_RA_CHG_UPDATES,
		["addedHeight"] = 15,
		{ 45, CT_RA_CHG4_1 },
		{ 30, CT_RA_CHG4_2 },
		{ 30, CT_RA_CHG4_3 },
		{ 20, CT_RA_CHG4_4 },
		{ 20, CT_RA_CHG4_5 },
		{ 20, CT_RA_CHG4_6 }
	},
	["section5"] = {
		["title"] = CT_RA_CHG_FIXES,
		{ 30, CT_RA_CHG5_1 },
		{ 20, CT_RA_CHG5_2 },
		{ 30, CT_RA_CHG5_3 },
		{ 20, CT_RA_CHG5_4 },
		{ 30, CT_RA_CHG5_5 },
		{ 30, CT_RA_CHG5_6 },
		{ 30, CT_RA_CHG5_7 },
		{ 30, CT_RA_CHG5_8 },
		{ 30, CT_RA_CHG5_9 },
		{ 30, CT_RA_CHG5_10 }
	}
};
for k, v in CT_RA_Changes do
	if ( type(v) == "table" ) then
		for key, val in v do
			if ( type(val) == "table" ) then
				while ( string.find(val[2], "|[bg].-|e[bg]") ) do
					CT_RA_Changes[k][key][2] = string.gsub(val[2], "^(.*)|b(.-)|eb(.*)$", "%1|c00FFD100%2|r%3");
					CT_RA_Changes[k][key][2] = string.gsub(CT_RA_Changes[k][key][2], "^(.*)|g(.-)|eg(.*)$", "%1|c00FF0000%2|r%3");
				end
			end
		end
	end
end