Yeah, I just changed this so that the server renders the modal dialog content.  Not client-side rendering, but much less disgusting certainly.