Select function based on type from context.
Authored by: whebisch 2009-03-26
Parent: [r556]
Child: [r558]