//<![CDATA[
function googleMap(outputAddress, searchAddress, map_canvas){			   
	var geocoder;
	var map;   
    // A GraphicalZoomControl is a GControl that displays garphical "Zoom In"
    // and "Zoom Out" buttons (as opposed to the iconic buttons used in
    // Google Maps).
    function GraphicalZoomControl() {
    }
    GraphicalZoomControl.prototype = new GControl();

    // Creates a one DIV for each of the buttons and places them in a container
    // DIV which is returned as our control element. We add the control to
    // to the map container and return the element for the map class to
    // position properly.
    GraphicalZoomControl.prototype.initialize = function(map) {
      var container = document.createElement("div");

      var zoomInDiv = document.createElement("div");
      this.setButtonStyle_(zoomInDiv,"/assets/layout/image/png/plus.png");
      container.appendChild(zoomInDiv);
      GEvent.addDomListener(zoomInDiv, "click", function() {
        map.zoomIn();
      });
	  
      var zoomOutDiv = document.createElement("div");
      this.setButtonStyle_(zoomOutDiv,"/assets/layout/image/png/minus.png");
      container.appendChild(zoomOutDiv);
      GEvent.addDomListener(zoomOutDiv, "click", function() {
        map.zoomOut();
      });	  

      map.getContainer().appendChild(container);
      return container;
    }

    // By default, the control will appear in the top left corner of the
    // map with 7 pixels of padding.
    GraphicalZoomControl.prototype.getDefaultPosition = function() {
      return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(7, 7));
    }

    // Sets the proper CSS for the given button element.
    GraphicalZoomControl.prototype.setButtonStyle_ = function(button,img) {
      button.style.textDecoration					= "none";
      button.style.marginBottom						= "3px"; 
      button.style.cursor							= "pointer";
	  button.style.width							= "25px";
	  button.style.height							= "24px";
	  var is_ie										= ((navigator.userAgent.toLowerCase().indexOf("msie") != -1) && (navigator.userAgent.toLowerCase().indexOf("opera") == -1));
	  var is_ie6									= (is_ie && (parseInt(navigator.appVersion) == 4) && (navigator.userAgent.toLowerCase().indexOf("msie 6.")!=-1) );
	  if(is_ie6){
		  button.style.filter						= "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'"+ img +"\', sizingMethod='scale');";
	  }else{
		  button.style.backgroundImage				= "url("+ img +")";
	  }
    }	
	
	if (GBrowserIsCompatible()) {
		// Create new map object
		map = new GMap2(document.getElementById(map_canvas));
		//map.setUIToDefault();    
		
		// Add new controls
		map.addControl(new GraphicalZoomControl());
		
		// Create new geocoding object
		geocoder = new GClientGeocoder();    
		// Retrieve location information, pass it to addToMap()
		geocoder.getLocations(searchAddress, addToMap);
	}
	
	// EIGENE MARKER
	var baseIcon = new GIcon();
	baseIcon.image = "/assets/layout/image/gif/reddot.gif";
	baseIcon.iconSize = new GSize(14, 14);
	// baseIcon.shadow = "/files/service/anfahrt/image/png/pointer_shadow.png";
	// baseIcon.shadowSize = new GSize(50, 20);
	baseIcon.iconAnchor = new GPoint(7, 7);
	baseIcon.infoWindowAnchor = new GPoint(7, 4);
	
	// This function adds the point to the map    
	function addToMap(response)    {
		// Retrieve the object
		place = response.Placemark[0];
		
		// Retrieve the latitude and longitude
		point = new GLatLng(place.Point.coordinates[1],place.Point.coordinates[0]);
		
		// Center the map on this point
		map.setCenter(point, 14);
		
		// Create a marker
		var marker = new GMarker(point, {icon:baseIcon});
		
		// Add the marker to map
		map.addOverlay(marker);
		
		// Add to activate the info window
		/*marker.openInfoWindowHtml(outputAddress);*/
		
		// Add address information to marker
		GEvent.addListener(marker, "click", function() {
			marker.openInfoWindowHtml(outputAddress);
		});          
	} 
}
//]]>    

