get ready the javascript for preview dialog.