// Start position for the map (hardcoded here for simplicity)
var lat=48.2510;
var lon=11.6508;
var zoom=17;
var map; //complex object of type OpenLayers.Map

//Initialise the 'map' object
function initOSM() {

	map = new OpenLayers.Map ("map_canvas", {
		controls:[
			new OpenLayers.Control.Navigation(),
			new OpenLayers.Control.PanZoomBar(),
			new OpenLayers.Control.Attribution()],
		maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
		maxResolution: 156543.0399,
		numZoomLevels: 19,
		units: 'm',
		projection: new OpenLayers.Projection("EPSG:900913"),
		displayProjection: new OpenLayers.Projection("EPSG:4326")
	} );


	// Define the map layer
	// Other defined layers are OpenLayers.Layer.OSM.Mapnik, OpenLayers.Layer.OSM.Maplint and OpenLayers.Layer.OSM.CycleMap
	layerTilesAtHome = new OpenLayers.Layer.OSM.Mapnik("Mapnik");
	map.addLayer(layerTilesAtHome);

	var pois = new OpenLayers.Layer.Text( "My Points",
			{ location:"./anfahrt-poi.txt",
			  projection: map.displayProjection
			});
	map.addLayer(pois);

	if( ! map.getCenter() ){
		var lonLat = new OpenLayers.LonLat(lon, lat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
		map.setCenter (lonLat, zoom);
	}
}

