<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ddwrt2="urn:frontpage:internal">
 <xsl:output method="html" indent="no"/>
 <xsl:template match="/" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">
  <xsl:call-template name="dvt_1"/>
 </xsl:template>
 <xsl:template name="dvt_1">
  <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row" />
  <xsl:call-template name="dvt_1.body">
   <xsl:with-param name="Rows" select="$Rows" />
  </xsl:call-template>
 </xsl:template>
 <xsl:template name="dvt_1.body">
  <xsl:param name="Rows" />
  <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAA6MgdObQFZgu8bWQ-Szz6NhRkouqk-r_ytxPWlEdWj1HbKlknBxRpJ_H77pWa3poqNs1m9yWJBMln5Q" type="text/javascript">
  </script>
  <div id="xslmap" style="width:750px; height:400px">
  </div>


  <script type="text/javascript">
  function addLoadEvent(func) {
     var oldonload = window.onload;
     
     if (typeof window.onload != 'function') {
       window.onload = func;
     } 
     else {
       window.onload = function() {
         oldonload();
         func();
       }
     }
  }     

        var point;
        var marker;
        var address;
        var htmladdress;

        var map = new GMap2(document.getElementById("xslmap"));
        map.setCenter(new GLatLng(51, -129), 4);
        map.checkResize();

        map.addControl(new GMapTypeControl());
        map.addControl(new GLargeMapControl());
        map.enableScrollWheelZoom();

        var geocoder = new GClientGeocoder();


  addLoadEvent(function() { map.checkResize(); });

       </script>
  <xsl:for-each select="$Rows">
   <xsl:call-template name="dvt_1.rowview" />
  </xsl:for-each>
  <script type="text/javascript">
        function showAddress(address) {
            if (geocoder) {
          geocoder.getLatLng(address, function(point) {if (!point) { var marker = new GMarker(new GLatLng(39.6,-98)); map.addOverlay(marker); marker.openInfoWindowHtml(address); } else { var marker = new GMarker(point); map.addOverlay(marker); marker.openInfoWindowHtml(address); } } );
        } else {
          var point = new GLatLng(39.6,-98); 
          var marker = new GMarker(point); 
          map.addOverlay(marker); 
           marker.openInfoWindowHtml("Testing");
        }
     }     
      </script>
 </xsl:template>
 <xsl:template name="dvt_1.rowview">
  <script type="text/javascript">
        address = &quot;<xsl:value-of select="@Address" />&quot; + ", " + &quot;<xsl:value-of select="@City" />&quot;  + ", " + &quot;<xsl:value-of select="@State" />&quot;  + ", " + &quot;<xsl:value-of select="@ZipCode" />&quot;  + ", " + &quot;<xsl:value-of select="@Country" />&quot; ;      
       geocoder.getLatLng(  address,  function(point)  {  if (point)  {   var marker = new GMarker(point);  map.addOverlay(marker);  GEvent.addListener (   marker,   &quot;click&quot;,   function()  {   this.openInfoWindowHtml( &quot;&lt;A HREF&quot; + "=" + &quot;&apos;&quot; + "mashing.aspx?email=" + &quot;<xsl:value-of select="@EmailAddress" />&quot; + &quot;&apos;&gt;&quot; + &quot;<xsl:value-of select="@FullName" />&quot; + &quot;&lt;a&gt;&quot; + &quot;<br />&quot; + &quot;<xsl:value-of select="@EmailAddress" />&quot; + &quot;<br />&quot; + &quot;<xsl:value-of select="@Address" />&quot; + &quot;<br />&quot; + &quot;<xsl:value-of select="@City" />&quot;  + ", " + &quot;<xsl:value-of select="@State" />&quot;  + " " + &quot;<xsl:value-of select="@ZipCode" />&quot;  + ", " + &quot;<xsl:value-of select="@Country" />&quot;);  }  );  }  }  );
      </script>
  </xsl:template>
</xsl:stylesheet>
