
    var map = null;
    var geocoder = null;
	var strAdres = null;
	var strExtraInfo = null;
     var ads;

    function addAddressToMap(response) {
      map.clearOverlays();
      if (!response || response.Status.code != 200) {
        alert("Sorry, we were unable to geocode that address");
      } else {

        place = response.Placemark[0];
        point = new GLatLng(place.Point.coordinates[1],
                            place.Point.coordinates[0]);
       map.setCenter(point, 16, G_NORMAL_MAP	);

        var marker = new GMarker(point);


       map.addOverlay(marker);

       var Address = "Adres: " + strAdres; //place.address;

       try {
      		var gewest =  place.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName;
		} catch (e) {
			var gewest = "";
		}



	   // Vlaams gewest
	   try {
	   	var provincie = "  provincie:"+place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.SubAdministrativeAreaName + ', ';
   		} catch (e) {
	   		var provincie = "";
	   		//alert("Oops, geen provincie!");
   		}

	   try {
	   	var gemeente =  "   Gemeente:"+place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.LocalityName + ', ';
   		} catch(e) {
	   	  var gemeente = "" ;
     }

	   var NB = parseInt(place.Point.coordinates[1]);
	   var OL = parseInt(place.Point.coordinates[0]);
	   var fracNB = parseInt((place.Point.coordinates[1] - NB) * 100);
	   var fracOL = parseInt((place.Point.coordinates[0] - OL) * 100);
	   var coord =     'Coordinaten: ' +  NB + "\u00b0" + fracNB + '\'NB ' + OL + "\u00b0" + fracOL + '\'OL';
	   var strInfo = Address + '<br>' + gemeente + provincie ;
	   strInfo = strInfo + gewest + '<br>' + coord;
	   if (strExtraInfo != null) {
			strInfo = '<b><u>'+strExtraInfo + '</b></u><br><br>' + strInfo;
	   }

		marker.openInfoWindowHtml(strInfo);

      }
    }

    // showLocation() is called when you click on the Search button
    // in the form.  It geocodes the address entered into the form
    // and adds a marker to the map at that location.
    function showLocation(adres,info) {
	  strAdres = adres;

	  strExtraInfo = info;
          map = new GMap2(document.getElementById("map"));
          map.addControl(new GLargeMapControl());
          map.addControl(new GScaleControl());
          map.addControl(new GOverviewMapControl());
          map.addControl(new GMapTypeControl());
	       					mwh();

      geocoder = new GClientGeocoder();

      geocoder.getLocations(adres, addAddressToMap);
    }

    		// ----- mousewheel
			function zoom(oEvent, s)
			{
				if(s == -120)
				{
					map.zoomOut();
				}

				if(s == 120)
				{
					map.zoomIn();
				}
			}


			function mwh()
			{
				var d = document.getElementById("map");

				if (d)
				{
					try
					{
						if (document.body.addEventListener)
						{
							d.addEventListener('DOMMouseScroll', function(oEvent) {zoom(oEvent, oEvent.detail * -40); }, false);
						}
						 else
						{
							d.onmousewheel = function() { zoom(event, event.wheelDelta); return false; }
						}
					}

					catch (ex) {}
				}
		}

