var mapHelper = {
	
	// setup
		
	lat1: 48.1412,
	lng1: 11.5763,
	
	lat2: 48.13948,
	lng2: 11.57603,
	
	zoomLevel: 14,
	
	containerId: "googlemaps",
	
	mapTypeSelect: 'dropdown', // [none|simple|dropdown|nested]
	mapControl: 'zoom', // [none|zoom|small|large]
	showOverview: false,
	showScale: false,
	scrollZoom: true,
	
	showMarker: true,
	showInfoWindow: true,
	infoWindowContent1: '<p style="font-size: 12px;"><img src="/fileadmin/images/Google_Maps/medical_center.jpg" width="65" align="left" hspace=5 vspace=1><b>Sensualmedics®</b><br>Munich Medical Center<br>Salvatorstr. 3<br>80333 München<br><a href="http://maps.google.de/maps?f=q&hl=de&geocode=&q=Salvatorstr+3,+80333+Muenchen&sll=48.1412,11.5763&g=Salvatorstr+3,+80333+Muenchen&ll=48.1412,11.5763&spn=0.009426,0.019312&z=15&iwloc=addr&iwstate1=dir&t=m" target="_blank">Anfahrt berechnen</a><b></b></p>',
	// infoWindowContent2: '<p style="font-size: 12px;"><b>Sensualmedics®</b><br>Munich Medical Center Dependance<br>Theatinerstr. 46<br>80333 München<br><a href="http://maps.google.de/maps?f=q&hl=de&geocode=&q=Theatinerstr+46,+80333+Muenchen&sll=48.13948,11.57603&g=Theatinerstr+46,+80333+Muenchen&ll=48.13948,11.57603&spn=0.009426,0.019312&z=15&iwloc=addr&iwstate1=dir&t=m" target="_blank">Anfahrt berechnen</a><b></b></p>',
	infoWindowId: "mapInfoWindow",
	
	// setup done
	
	init: function() {
		var node = document.getElementById(this.containerId);
		if(!node || !GBrowserIsCompatible()) { return; }
		
		var map = new GMap2(node)
		var loc1 = new GLatLng(this.lat1,this.lng1), infoWin = null;
		var loc2 = new GLatLng(this.lat2,this.lng2), infoWin = null;
		map.setCenter(loc1, this.zoomLevel);
		var bottomRight = new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10,10));

		
		switch(this.mapControl) {
			case 'zoom':
				map.addControl(new GSmallZoomControl(), bottomRight);
				break;
			case 'small':
				map.addControl(new GSmallMapControl(), bottomRight);
			break;
			case 'large':
				map.addControl(new GLargeMapControl(), bottomRight);
			break;
		}
		switch(this.mapTypeSelect) {
			case 'simple':
				map.addControl(new GMapTypeControl(), bottomRight);
				break;
			case 'dropdown':
				map.addControl(new GMenuMapTypeControl());
				break;
			case 'nested':
				map.addControl(new GHierarchicalMapTypeControl(), bottomRight);
				break;
		}
		if(this.showOverview) { map.addControl(new GOverviewMapControl(), bottomRight); }
		if(this.scrollZoom) { map.enableScrollWheelZoom(); }
		if(this.showScale) { map.addControl(new GScaleControl(), bottomRight); }
		
		var marker1 = new GMarker(loc1);
		map.addOverlay(marker1);
		if(!this.showMarker) {
			marker1.hide();
		}
		
		/*var marker2 = new GMarker(loc2);
		map.addOverlay(marker2);
		if(!this.showMarker) {
			marker2.hide();
		}*/
		/*if(this.showInfoWindow) {
			map.openInfoWindow(loc,this.createInfoWindow(),{maxWidth:50});
		}*/
		if(this.showMarker && this.showInfoWindow) {
			GEvent.addListener(marker1,'click',function() {
				if(map.getInfoWindow().isHidden) {
					map.openInfoWindow(loc1,mapHelper.createInfoWindow(1)); 
				}
			});
		}
		if(this.showMarker && this.showInfoWindow) {
			GEvent.addListener(marker2,'click',function() {
				if(map.getInfoWindow().isHidden) {
					map.openInfoWindow(loc2,mapHelper.createInfoWindow(2)); 
				}
			});
		}
	},
	
	createInfoWindow: function(content_id) {
		var infoWindow = document.createElement('div');
		/*infoWindow.reset(this.getPoint(),infoWindow.getTabs(),new GSize(200,200),null,null);*/
		infoWindow.id = this.infoWindowId;
		if(content_id == 1)
			infoWindow.innerHTML = this.infoWindowContent1;
		else
			infoWindow.innerHTML = this.infoWindowContent2;
		return infoWindow;
	},
	
	unload: function () {
		GUnload();
	}
};
