var map = null;

function goMap24(){
	map = Map24.Webservices.getMap24Application({
		AppKey: "FJXe873da8dca64cdfd63e73411cc2ffX13",
		MapArea: document.getElementById( "maparea" ),
		MapWidth: 430,
		MapHeight: 400
	});

	geocode( 'lehbekwiese 6 24395 gelting' );
}

function geocode( addressString ){
	map.Webservices.sendRequest(
		new Map24.Webservices.Request.MapSearchFree(map, {
			SearchText: addressString,
			MaxNoOfAlternatives: 50
		})
	);

	map.onMapSearchFree = function( event ){
		var mrcContainer = new Map24.Webservices.Request.MapletRemoteControl( map );
		var firstResult = event.Alternatives[0];
		var lon = firstResult.Coordinate.Longitude;
		var lat = firstResult.Coordinate.Latitude;

      var mrcContainer = new Map24.Webservices.Request.MapletRemoteControl( map );
      mrcContainer.push(
        new Map24.Webservices.MRC.DeclareMap24Location({
          	MapObjectID: "myLocation",
            Coordinate: new Map24.Coordinate( lon, lat ),
            LogoURL: "http://www.herrenausstatter-an-der-schlei.de/fileadmin/templates/map24/symbol.gif",
            SymbolID: 20100
          })
      );
		  
      mrcContainer.push(
        new Map24.Webservices.MRC.ControlMapObject({
          Control: "ENABLE",
          MapObjectIDs: "myLocation"
        })
      );		
		
		mrcContainer.push(
			new Map24.Webservices.MRC.SetMapView({
				Coordinates: new Map24.Coordinate( lon, lat ),
				ClippingWidth: new Map24.Webservices.ClippingWidth(
					{ MinimumWidth: 2000 }
				)
			})
		);
		map.Webservices.sendRequest( mrcContainer );
	}
	
}

