function MailIcon_onLoad()
	ORIG_InboxFrame_Update = InboxFrame_Update;
	InboxFrame_Update = MailIcon_InboxFrame_Update;
end


function MailIcon_InboxFrame_Update()
	ORIG_InboxFrame_Update();

	local numItems = GetInboxNumItems();
	local index = ((InboxFrame.pageNum - 1) * INBOXITEMS_TO_DISPLAY) + 1;
	for i=1, INBOXITEMS_TO_DISPLAY do
		if (index <= numItems) then
			-- show icon
			getglobal("MailItem"..i.."ExpireTimeIcon"):Show();

			-- set texture
			local expireTimeIconTexture;
			if (InboxItemCanDelete(index)) then
				expireTimeIconTexture = "Interface\\AddOns\\MailIcon\\IconMailDeleted";
			else 
				expireTimeIconTexture = "Interface\\AddOns\\MailIcon\\IconMailReturned";
			end
			getglobal("MailItem"..i.."ExpireTimeIconIcon"):SetTexture(expireTimeIconTexture);
		else
			-- hide icon
			getglobal("MailItem"..i.."ExpireTimeIcon"):Hide();
		end
		index = index + 1;
	end


end