title: JavaScript In KML Ignored By Google Earth Plugin
body: <p>I've created a simple KML file that works in the standalone Google Earth client, but won't work at all in the Google Earth Plugin (regardless of browser):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom"&gt;
      &lt;Folder&gt;
          &lt;name&gt;South Florida&lt;/name&gt;
          &lt;open&gt;1&lt;/open&gt;
          &lt;Document&gt;
              &lt;name&gt;Miami&lt;/name&gt;
              &lt;Style id="miami_style"&gt;
                  &lt;IconStyle&gt;
                      &lt;Icon&gt;
                          &lt;href&gt;http://i.imgur.com/CNrRU.gif&lt;/href&gt;
                      &lt;/Icon&gt;
                  &lt;/IconStyle&gt;
                  &lt;BalloonStyle&gt;
                      &lt;text&gt;&lt;![CDATA[&lt;font face="Arial"&gt;$[description]&lt;/font&gt;]]&gt;&lt;/text&gt;
                  &lt;/BalloonStyle&gt;
              &lt;/Style&gt;
              &lt;Folder&gt;
                  &lt;name&gt;Miami&lt;/name&gt;
                  &lt;open&gt;1&lt;/open&gt;
                  &lt;Placemark id="Miami"&gt;
                      &lt;name&gt;Miami&lt;/name&gt;
                      &lt;description&gt;&lt;![CDATA[
                          &lt;script type="text/javascript"&gt;
                              function hideImage() {
                                  var image = document.getElementById("image");
                                  image.style.opacity = 0;
                                  image.style.MozOpacity = 0;
                                  image.style.KhtmlOpacity = 0;
                                  image.filter = "alpha(opacity=0)";
                              }
                          &lt;/script&gt;
                          &lt;button id='clicker' onclick='hideImage();'&gt;Click Me&lt;/button&gt;
                          &lt;img id="image" src="http://i.imgur.com/4rhT7.png"&gt;
                      ]]&gt;&lt;/description&gt;
                      &lt;styleUrl&gt;#miami_style&lt;/styleUrl&gt;
                      &lt;Point&gt;
                          &lt;coordinates&gt;-80.22643611111111,25.788952777777777,0&lt;/coordinates&gt;
                      &lt;/Point&gt;
                  &lt;/Placemark&gt;
              &lt;/Folder&gt;
          &lt;/Document&gt;
      &lt;/Folder&gt;
  &lt;/kml&gt;
  </code></pre>
  
  <p>Basically, I have an image that displays by default, and I want to make it go away when I click the button. Eventually, I want to be able to toggle images by clicking, but I figure this needs to work first in order to get to that step.</p>
  
  <p>This works perfectly fine in standalone Google Earth, but doesn't work in the Google Earth Plugin.</p>
  
  <p>Oddly, this also works in the Google Earth Plugin if I run it in a JavaScript console <em>after</em> the balloon is already displayed. It just doesn't acknowledge the code already in the file.</p>
  
  <p>Any ideas?</p>