Remove redundant javascript function to open a dialog