﻿//<![CDATA[

var geocoder ;
var icon ;
var gicon ;
var map ;
var bounds;

function load()
{
 map = new GMap2(document.getElementById("map"));
 var start = new GLatLng(51.049011, 3.729711);
 map.setCenter(start, 3);
 map.addControl(new GLargeMapControl());
 map.addControl(new GMapTypeControl());
 map.addControl(new GScaleControl()) ;
 bounds = new GLatLngBounds();
 geocoder = new GClientGeocoder() ;
 newsicon = new GIcon();
 newsicon.image = "/images/boat.png";
 newsicon.iconSize = new GSize(56, 56);
 newsicon.iconAnchor = new GPoint(17, 53); 
 
 var address = unescape("Kuiperskaai 24,9000 Gent");
 showAddress(address) ;

}

function showAddress(address)
{
 geocoder.getLatLng( address, function(point)
 {
  if (!point)
  {
   alert(address + " not found")
  } else
  {
   bounds.extend(point);

   var marker = new GMarker(point, {icon:newsicon, title: address});
   map.setZoom(map.getBoundsZoomLevel(bounds));
   map.zoomOut();
   map.setCenter(bounds.getCenter());
   map.addOverlay(marker);
  }
 }) ;
}

//]]>

