added javascript to show/hide dialog box