<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>Google/Maps/Infowindow.php</filename>
    </added>
    <added>
      <filename>css/infowindow.css</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -21,6 +21,7 @@ require_once 'Google/Maps/Point.php';
 require_once 'Google/Maps/Marker.php';
 require_once 'Google/Maps/Path.php';
 require_once 'Google/Maps/Control.php';
+require_once 'Google/Maps/Infowindow.php';
 
 class Google_Maps extends Google_Maps_Overload {
         </diff>
      <filename>Google/Maps.php</filename>
    </modified>
    <modified>
      <diff>@@ -32,5 +32,27 @@ abstract class Google_Maps_Location extends Google_Maps_Overload {
     * @return   object Google_Maps_Point
     */
     abstract public function toPoint();
+        
+    public function getContainerX(Google_Maps_Static $map) {
+        $zoom     = $map-&gt;getZoom();
+        $target_x = $this-&gt;toPoint()-&gt;getX();
+        $center_x = $map-&gt;getCenter()-&gt;toPoint()-&gt;getX();        
+        $delta_x  = ($target_x - $center_x) &gt;&gt; (21 - $zoom);
+        
+        $center_offset_x = round($map-&gt;getWidth() / 2);
+        
+        return $center_offset_x + $delta_x;
+    }
+
+    public function getContainerY(Google_Maps_Static $map) {
+        $zoom     = $map-&gt;getZoom();
+        $target_y = $this-&gt;toPoint()-&gt;getY();
+        $center_y = $map-&gt;getCenter()-&gt;toPoint()-&gt;getY();        
+        $delta_y  = ($target_y - $center_y) &gt;&gt; (21 - $zoom);
+        
+        $center_offset_y = round($map-&gt;getHeight() / 2);
+        
+        return $center_offset_y + $delta_y;
+    }
 
 }
\ No newline at end of file</diff>
      <filename>Google/Maps/Location.php</filename>
    </modified>
    <modified>
      <diff>@@ -17,12 +17,17 @@
  
 require_once 'Google/Maps/Coordinate.php';
  
-class Google_Maps_Marker extends Google_Maps_Overload {
+class Google_Maps_Marker extends Google_Maps_Location {
     
     protected $coordinate;
     protected $color;
     protected $size;
     protected $character;
+    protected $infowindow;
+    
+    protected $visible = false;
+    protected $id;
+    static public $counter = 1;
     
     /**
     * Class constructor.
@@ -34,6 +39,7 @@ class Google_Maps_Marker extends Google_Maps_Overload {
     public function __construct($location, $params = array()) {
         $this-&gt;setCoordinate($location);
         $this-&gt;setProperties($params);
+        $this-&gt;setId('marker_' . self::$counter++);
     }
     
     /**
@@ -41,25 +47,16 @@ class Google_Maps_Marker extends Google_Maps_Overload {
     *
     * @return   string
     */
-    public function toArea(Google_Maps_Static $map) {
-        $zoom     = $map-&gt;getZoom();
-        $target_x = $this-&gt;toPoint()-&gt;getX();
-        $target_y = $this-&gt;toPoint()-&gt;getY();
-        $center_x = $map-&gt;getCenter()-&gt;toPoint()-&gt;getX();
-        $center_y = $map-&gt;getCenter()-&gt;toPoint()-&gt;getY();
-        
-        $delta_x  = ($target_x - $center_x) &gt;&gt; (21 - $zoom);
-        $delta_y  = ($target_y - $center_y) &gt;&gt; (21 - $zoom);
-        
+    public function toArea(Google_Maps_Static $map) {        
+        $marker_x  = $this-&gt;getContainerX($map);
+        $marker_y  = $this-&gt;getContainerY($map) - 20;
+        $marker_id = $this-&gt;getId();
         
-        $center_offset_x = round($map-&gt;getWidth() / 2);
-        $center_offset_y = round($map-&gt;getHeight() / 2);
+        $string = 'infowindow=' . $marker_id . '&amp;';
+        $url = preg_replace('/infowindow=.*&amp;/', $string, $map-&gt;toQueryString());
         
-        $marker_x = $center_offset_x + $delta_x;
-        $marker_y = $center_offset_y + $delta_y - 20;
-        
-        return sprintf('&lt;area shape=&quot;circle&quot; coords=&quot;%d,%d,12&quot; href=&quot;#&quot;&gt;',
-                        $marker_x, $marker_y);
+        return sprintf('&lt;area shape=&quot;circle&quot; coords=&quot;%d,%d,12&quot; href=&quot;?%s&quot; name=&quot;%s&quot;&gt;',
+                        $marker_x, $marker_y, $url, $marker_id);
     }
     
     /**
@@ -106,7 +103,7 @@ class Google_Maps_Marker extends Google_Maps_Overload {
     public function getLon() {
         return $this-&gt;getCoordinate()-&gt;getLon();
     }
-    
+            
     public function __toString() {
         $retval = $this-&gt;getLat() . ',' . $this-&gt;getLon() . ','. $this-&gt;getColor() . $this-&gt;getSize() . $this-&gt;getCharacter();
         return preg_replace('/,$/', '', $retval);</diff>
      <filename>Google/Maps/Marker.php</filename>
    </modified>
    <modified>
      <diff>@@ -387,11 +387,21 @@ class Google_Maps_Static extends Google_Maps_Overload {
     * 
     * @return   string Static map image URL querystring.
     */
+    /*
+        TODO $include_all here is freaking unelegant
+    */
     public function toQueryString($include_all = false) {        
         $url['center'] = $this-&gt;getCenter()-&gt;__toString();
+
+        foreach ($this-&gt;getMarkers() as $marker) {
+            if ($marker-&gt;getInfowindow()-&gt;isVisible()) {
+                $url['infowindow'] = $marker-&gt;getId();
+            }
+        }
+
+        $url['zoom']   = $this-&gt;getZoom();
         
         if ($include_all) {
-            $url['zoom'] = $this-&gt;getZoom();
             $url['markers'] = $this-&gt;getMarkers('string');
             $url['path'] = $this-&gt;getPath('string');
             $url['size'] = $this-&gt;getSize();
@@ -439,10 +449,12 @@ class Google_Maps_Static extends Google_Maps_Overload {
         foreach ($this-&gt;getControls() as $control) {
             $retval .= $control-&gt;toHtml($this) . &quot;\n&quot;;
         }
+        foreach ($this-&gt;getMarkers() as $marker) {
+            $retval .= $marker-&gt;getInfowindow()-&gt;toHtml($this, $marker) . &quot;\n&quot;;
+        }
         $retval .= '&lt;/div&gt;' . &quot;\n&quot;;
         $retval .= '&lt;/div&gt;' . &quot;\n&quot;;
-
-
+        
         return $retval;
     }
     </diff>
      <filename>Google/Maps/Static.php</filename>
    </modified>
    <modified>
      <diff>@@ -18,12 +18,25 @@ $coord_2  = new Google_Maps_Coordinate('58.379646', '26.764090');
 $marker_1 = new Google_Maps_Marker($coord_1);
 $marker_2 = new Google_Maps_Marker($coord_2);
 
+$bubble_1 = new Google_Maps_Infowindow('Foo Bar');
+$bubble_2 = new Google_Maps_Infowindow('Pler pop');
+
+$marker_1-&gt;setInfowindow($bubble_1);
+$marker_2-&gt;setInfowindow($bubble_2);
+
+//$bubble_1-&gt;show();
+//$marker_2-&gt;getInfowindow()-&gt;show();
+
 $map-&gt;addMarker($marker_1);
 $map-&gt;addMarker($marker_2);
 $map-&gt;setZoom(13);
 
 $map-&gt;setProperties($_GET);
 
+if ($_GET['infowindow']) {
+    $$_GET['infowindow']-&gt;getInfowindow()-&gt;show();
+}
+
 //print $map-&gt;toQueryString();
 
 ?&gt;
@@ -36,6 +49,7 @@ $map-&gt;setProperties($_GET);
   &lt;link href=&quot;http://www.appelsiini.net/stylesheets/screen.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
   &lt;link href=&quot;http://www.appelsiini.net/stylesheets/main.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
   &lt;link href=&quot;css/controls.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
+  &lt;link href=&quot;css/infowindow.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
   &lt;link rel=&quot;alternate&quot; type=&quot;application/atom+xml&quot; href=&quot;http://feeds.feedburner.com/tuupola&quot; title=&quot;Atom feed&quot; /&gt;
 &lt;/head&gt;
 &lt;body&gt;
@@ -72,7 +86,8 @@ $map-&gt;setProperties($_GET);
 		&lt;h4&gt;This page demonstrates how to add zoom and pan controls to static map.&lt;/h4&gt;
 	&lt;/div&gt;
 	&lt;div class=&quot;entrybody&quot;&gt;
-    &lt;?php print $map-&gt;toHtml(); ?&gt;&lt;br /&gt;&lt;br /&gt;
+    &lt;?php print $map-&gt;toHtml(); ?&gt;
+    &lt;br /&gt;&lt;br /&gt;
 	  &lt;p&gt;
 	    Start by creating static map with &lt;i&gt;Google_Maps::create('static')&lt;/i&gt; factory method. 
 	    Create controls using &lt;i&gt;Google_Maps_Control::create('type')&lt;/i&gt;. Created control can 
@@ -122,12 +137,16 @@ $map-&gt;addControl($pan);&lt;/pre&gt;
 
 &lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js&quot; type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;
 &lt;script type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;
+  /*
   $(function() {
       $('map area').bind('click', function() {
-          alert('You clicked on marker.');
+          $('.bubble').hide();
+          var id = '#' + $(this).attr('name');
+          $(id).show();
           return false;
       });
   });
+  */
 &lt;/script&gt;      
 
 &lt;script src=&quot;/mint/?js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</diff>
      <filename>controls.html</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ba3510ca5cf706e5b0e5b70bbfdefbfeade93026</id>
    </parent>
  </parents>
  <author>
    <name>Mika Tuupola</name>
    <email>tuupola@appelsiini.net</email>
  </author>
  <url>http://github.com/tuupola/php_google_maps/commit/40b23eda165214125fd124bdf20e838b9d2dbee4</url>
  <id>40b23eda165214125fd124bdf20e838b9d2dbee4</id>
  <committed-date>2008-10-21T13:08:05-07:00</committed-date>
  <authored-date>2008-10-21T13:08:05-07:00</authored-date>
  <message>First working version of non JavaScript infowindows / bubbles.</message>
  <tree>5687bc2855cdb899b6e07b105193dd6ea5e57c26</tree>
  <committer>
    <name>Mika Tuupola</name>
    <email>tuupola@appelsiini.net</email>
  </committer>
</commit>
