function Map()
{
	this.map = false;
	this.mapDiv = false;
	this.mapControlsObject = false;
	this.markerManagerObject = false;
	this.maxZoom = 17;
	this.minZoom = 12;
	
	this.initialize = function(action)
	{
		if (!GBrowserIsCompatible()) { this.mapDiv.innerHTML = 'Google Maps word niet ondersteund.'; return; }
		this.mapDiv = $("#map").get(0);
		if(action == 'connected') { this.mapDiv.style.width  = (applicationObject.viewportWidth - 22) + 'px'; }
		var zoom = 13;
		// create custom tile layer
		var tilelayers = [new GTileLayer(new GCopyrightCollection("&#169;2009 Greenberry"), 1,18)];
		tilelayers[0].getCopyright = function(a,b) { return {prefix:"", copyrightTexts:["&#169;2009 Greenberry"]}; };
		tilelayers[0].getTileUrl = function (a,b) { url = applicationObject.rootPath+"images/spacer.gif"; return url; };
		gbmap = new GMapType(tilelayers, new GMercatorProjection(18), "Map",{errorMessage:"Geen data beschikbaar"});
		
		this.map = new GMap2(this.mapDiv, { backgroundColor: '#000000', mapTypes:[gbmap] });
		
		if(action != 'home')
		{
			this.setCenter('0.02265930116714652', '0.001373291015625', zoom);
		}
		else
		{
			this.setCenter('0.0', '0.0', zoom);
		}

		this.map.disableDoubleClickZoom();
		
		// Set map controls....
		if(action != 'home')
		{
			//this.mapControlsObject = new MapControls();
			//this.mapControlsObject.zoomControls();
		}

		// Set marker manager
		this.markerManagerObject = new MarkerManager();

		// Do nasty stuff
	}
	
	this.setMapType = function(type)
	{
		this.map.setMapType(type);
	}

	this.setCenter = function(lat, lng, zoom)
	{
		var zoom = zoom || this.map.getZoom();
		this.map.setCenter(new GLatLng(lat, lng), zoom);
	}

	this.panMap = function(dx, dy)
	{
		this.map.panDirection(dx,  dy);
	}
	
	this.zoomInMap = function()
	{
		var zoom = this.map.getZoom();
		zoom++;
		if(zoom > this.maxZoom) { zoom = this.maxZoom; }
		if(zoom < this.maxZoom)
		{
			this.markerManagerObject.zoomMarkerGroups(1);
			this.map.setZoom(zoom);
		}
	}
	
	this.zoomOutMap = function()
	{
		var zoom = this.map.getZoom();
		zoom--;
		if(zoom < this.minZoom) { zoom = this.minZoom; }
		if(zoom > this.minZoom)
		{
			this.markerManagerObject.zoomMarkerGroups(-1);
			this.map.setZoom(zoom);
		}
	}
	
	this.getMapType = function()
	{
		return this.mapType;
	}
	
	this.clearMap = function()
	{
		this.map.clearOverlays();
	}
	
	this.mapMoved = function()
	{
		this.map.lastCenter = this.map.getCenter();
	}
}