if this is the case, the code might be window.opener.opener.auto().
you can check that by having alert(window.opener.opener.crmForm) -> if you are in the one the detail form or alert(window.opener.opener.crmGrid) -> if you are in the main screen or the related view.