This is pretty simple and is mainly just a place to dump this code for others to use. If you're wanting to programmatically change icons on your page and populate/change them based upon inputs from "somewhere else", then you'll need a collection of icons that you can perform a LookUp() against.
For example, say you want a generic toolbar to use in all of your apps and to control that based upon some settings you might import from Excel or retrieve from SharePoint. This would allow you to have a Collection of Icons displayed that would be populated with only what you need.