Here’s the JavaScript function I use to open SharePoint dialogues:

opendialogue