In SP2013 this is the correct way to do it according to Microsoft @ http://msdn.microsoft.com/en-us/library/jj245759.aspx

    // Make sure the SharePoint script file 'sp.js' is loaded before your // code runs.
    
    SP.SOD.executeFunc('sp.js', 'SP.ClientContext', openModalDialog);

Reference:

http://sharepoint.stackexchange.com/questions/60522/executeordelayuntilscriptloaded-not-executing-after-page-publish