Dialog API: Select field with Doctypes as options?

I’d like to build a custom email Dialog interface that closely replicated the “Send Email” dialog that’s included with Leads.

I need a way to use a Link field to select the Email Template, and have the Subject and Message fields populated with the data from the selected Email Template, the same way that the default Email Dialog does.

How do I populate a dialog field with the data from the selected linked DocType?