// JavaScript Document

//<![CDATA[

    var defaultZoomIn = 16;
 
    //<![CDATA[
      // this variable will collect the html which will eventualkly be placed in the sidebar
      var sidebar_html = "";
    
      // arrays to hold copies of the markers and html used by the sidebar
      // because the function closure trick doesnt work there
      var gmarkers = [];
      var htmls = [];
      var points = [];
      var i = 0;
   
   var map
    function load() {
      if (GBrowserIsCompatible()) {
   
   
          // A function to create the marker and set up the event window
       // Dont try to unroll this function. It has to be here for the function closure
       // Each instance of the function preserves the contends of a different instance
       // of the "marker" and "html" variables which will be needed later when the event triggers.    
       function createMarker(point,name,html) {
         var marker = new GMarker(point);
         GEvent.addListener(marker, "click", function() {
           marker.openInfoWindowHtml('<div style="font-family:arial,verdana;color:#000;">'+html+'</div>');
     
     map.setZoom(defaultZoomIn);
     map.panTo(point);
         });
   // save the info we need to use later for the sidebar
         gmarkers[i] = marker;
         htmls[i] = '<div style="font-family:arial,verdana;color:#000;">'+html+'</div>';
        points[i] = point;
      
     
       // add a line to the sidebar html
         //sidebar_html += '<a href="javascript:myclick(' + i + ')">' + name + '</a><br>';
          i++;
  
   
         return marker;
       }
  
   
      // Display the map, with some controls and set the initial location 
      map = new GMap2(document.getElementById("map"));
 //  map.enableContinuousZoom()
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
      //zoomed out map.setCenter(new GLatLng(51.52,-0.1056),6);
   map.setCenter(new GLatLng(51.492937, -0.230634),defaultZoomIn);
     
      // Set up three markers with info windows 
    
 
      var point = new GLatLng(51.492937, -0.230634, true);
      var marker = createMarker(point,'1st','<strong>PK studios</strong><br />20 Dimes Place<br />King Street<br />London<br />W6 0QR')
      map.addOverlay(marker);
 //map.centerAndZoom(new GPoint(-122.1419, 37.4419), 4);
   
      }
    }

    window.onload = function(){
load()
}

    //]]>