title: Document.onclick running twice
body: <p>I'm trying to add a mailto link via javascript to an element within a tooltip. I've had to put the code in a <code>document.onclick</code> as the code doesn't run if it's not. So now i have it working but the problem is you need to click twice on the link for it to fire. Is there a way for remove the 2 clicks? If this function isn't within the document.onclick it doesn't work. Thanks in advance..</p>
  
  <pre><code>document.onclick = function(){
       jQuery(".gm_popup .email").click(function(){
          var text = jQuery(this).text();
          document.location = "mailto:" + text.trim();
      });
    }
  </code></pre>