hide module when path is overlay
You should use the following code, if you want to avoid outputting something when the overlay is visualized.

if (module_exists('overlay') &amp;&amp; path_is_admin($_GET['q'])) {
  // The overlay is visualized.
}


path_is_admin() is used from overlay_init(), which contains the following code.

  // If this page shouldn't be rendered inside the overlay, redirect to the
  // parent.
  elseif (!path_is_admin($current_path)) {
    overlay_close_dialog($current_path, array('query' =&gt; drupal_get_query_parameters(NULL, array('q', 'render'))));
  }