var GM = (function(){
	return {
		
		init: function()
		{
			that = this;
			
			this.locations = new Array();
			this.map = new google.maps.Map2(document.getElementById("map"));
			this.map.addControl(new GLargeMapControl());
			this.map.addControl(new GMapTypeControl());
			this.map.enableContinuousZoom();
			this.map.setCenter(new google.maps.LatLng(51.342, 12.363), 12);

			this.showAddress();
		},
		
		showAddress: function() 
		{
			this.locations[0] = new Array();
			this.locations[0]['address'] = "Am Wasserwerk, Leipzig, DE";
			this.locations[0]['icon'] = "images/icon_wasserwerk.png";
			this.locations[0]['iconSize'] = new GSize(108, 54);
			this.locations[0]['iconAnchor'] = new GPoint(86, 45);	
			this.locations[0]['posX'] = 51.313943;
			this.locations[0]['posY'] = 12.418027;
					
			this.locations[1] = new Array();
			this.locations[1]['address'] = "Erich-Weinert-Straße, Leipzig, DE";
			this.locations[1]['icon'] = "images/icon_berliner_with_text.png";
			this.locations[1]['iconSize'] = new GSize(112, 70);
			this.locations[1]['iconAnchor'] = new GPoint(14, 45);
			this.locations[1]['posX'] = 51.3509;
			this.locations[1]['posY'] = 12.3805;
	
			this.locations[2] = new Array();
			this.locations[2]['address'] = "Marienweg 54, Leipzig, DE";
			this.locations[2]['icon'] = "images/icon_rosental.png";
			this.locations[2]['iconSize'] = new GSize(85, 54);
			this.locations[2]['iconAnchor'] = new GPoint(68, 46);
			this.locations[2]['posX'] = 51.353613;
			this.locations[2]['posY'] = 12.351873;
			
			this.locations[3] = new Array();
			this.locations[3]['address'] = "Johannisgasse 7/9, Leipzig, DE";
			this.locations[3]['icon'] = "images/icon_johannis.png"
			this.locations[3]['iconSize'] = new GSize(85, 54);
			this.locations[3]['iconAnchor'] = new GPoint(14, 48);
			this.locations[3]['posX'] = 51.337516;
			this.locations[3]['posY'] = 12.383502;
			
			for (i = 0; i < this.locations.length; i++)
			{	
				this.setMarker(i);
			}
		},
						
		setMarker: function(curEl) 
		{
	
			var pos = new GLatLng(this.locations[curEl]['posX'], this.locations[curEl]['posY']);
	
			var markerIcon = new GIcon(G_DEFAULT_ICON);
			markerIcon.image = this.locations[curEl]['icon'];
			markerIcon.iconSize = this.locations[curEl]['iconSize'];
			markerIcon.iconAnchor = this.locations[curEl]['iconAnchor'];
	
			markerOptions = { icon:markerIcon };
	
	
			this.map.addOverlay(new GMarker(pos, markerOptions));
				
		}
	}	
});

var app = new GM();
$(function () {
	app.init();
});

