var map=null;
var ovcontrol=null;
var geocoder=null;
var zoom_level=15;
var point=false;
var marker=null;

function Gload() {
  if (GBrowserIsCompatible()) {        
    map = new GMap2(document.getElementById("map"));
      
    map.addMapType(G_PHYSICAL_MAP);    
    map.addControl(new GLargeMapControl());  
    map.addControl(new GMapTypeControl());  
    map.setCenter(new GLatLng(22.367380201816758,114.11893844604492), 14);
    geocoder = new GClientGeocoder();
    
    ovcontrol = new GOverviewMapControl(new GSize(200,200));
    map.addControl(ovcontrol);
    
    function positionOverview(x,y) {
      var omap=document.getElementById("map_overview");
      omap.style.left = x+"px";
      omap.style.top = y+"px";
            
      omap.firstChild.style.border = "1px solid gray";

      omap.firstChild.firstChild.style.left="4px";
      omap.firstChild.firstChild.style.top="4px";
      omap.firstChild.firstChild.style.width="190px";
      omap.firstChild.firstChild.style.height="190px";
    }     
  }
}

function showAddress(address) {
  if (geocoder) {
    geocoder.getLatLng(
      address,
      function(point) {
        if (!point) {              
          alert("沒有找到相關地點!");          
        } else {
          map.setCenter(point, zoom_level);                
        }
      }
    );       
  }    
}
