﻿
    
    
    //<![CDATA[

    if (GBrowserIsCompatible()) {
      
      // 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 i = 0;


      // A function to create the marker and set up the event window
      function createMarker(point,name,html) {
        var marker = new GMarker(point);
        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
        
        // The new marker "mouseover" listener        
        GEvent.addListener(marker,"mouseover", function() {
          marker.openInfoWindowHtml(html);
        });    
        
        // The new marker "close" listener        
        GEvent.addListener(marker, "dblclick", function() {
          map.closeInfoWindow();
        });    
        
        // save the info we need to use later for the sidebar
        gmarkers[i] = marker;
        htmls[i] = html;
        // add a line to the sidebar html
        sidebar_html += '<li><a href="javascript:myclick(' + i + ')">' + name + '</a></li>';
        i++;
        return marker;
      }


      // This function picks up the click and opens the corresponding info window
      function myclick(i) {
        gmarkers[i].openInfoWindowHtml(htmls[i]);
      }


      // Display the map, with some controls and set the initial location 
      var map = new GMap(document.getElementById("map"));
      map.setMapType(G_SATELLITE_MAP); 
      map.addControl(new GLargeMapControl());
      map.addControl(new GScaleControl());
      map.addControl(new GOverviewMapControl());   
      map.addControl(new GMapTypeControl());
      GEvent.addListener(map, "moveend", function() {
        var center = map.getCenterLatLng();
        var latLngStr = '目前地圖中心點位置經緯度: ( ' + center.x + ', ' + center.y + ' ) - - &copy; 2006 Mike Lin - - <a href="mailto:golden360@hotmail.com">合作提案</a>';
        document.getElementById("message").innerHTML = latLngStr;
      });      
      map.centerAndZoom(new GPoint(127.64997482299804, 26.19526175361766), 3);

      // add the points   

      var point = new GPoint(127.64997482299804, 26.19526175361766);
      var marker = createMarker(point,'日本琉球那霸機場','<a target="_blank" href="http://www.golden360.com/go/to.php?list=http://www.naha-airport.co.jp/">日本琉球那霸機場</a>')
      map.addOverlay(marker); 
      
      var point = new GPoint(121.24116897583008, 25.083810984931393);
      var marker = createMarker(point,'台灣桃園中正機場','台灣桃園中正機場')
      map.addOverlay(marker);       
      

     
 
                       
                       
      // put the assembled sidebar_html contents into the sidebar div
      document.getElementById("sidebar").innerHTML = sidebar_html;
      
    }

    else {
      alert("Sorry, the Google Maps API is not compatible with this browser");
    }

    // This Javascript is based on code provided by the
    // Blackpool Community Church Javascript Team
    // http://www.commchurch.freeserve.co.uk/   
    // http://www.econym.demon.co.uk/googlemaps/

    //]]>

