finalized js scripts to populate modal dialogs