(function($) {

	window.gMapInitialize = function() {
		if($('#gmap').length < 1) {
			return false;
		}
		var el = document.getElementById('gmap');
		var map = new GMap2(el);
		var point = new GLatLng(47.54798, 7.69762);

		// shows new 3D controls
		var customUI = map.getDefaultUI();
		map.setUI(customUI);

		// Set map type
		map.setMapType(G_NORMAL_MAP);
		
		
		var marker = new GMarker(point);
		map.setCenter(point, 13); //<-- zoom faktor
		marker.myhtml = '<div class="map"><h2>Gersbacher Bauunternehmung GmbH</h2><p>Rheinfelderstr. 50-52<br/>79639 Grenzach-Whylen</p></div>';
		map.addOverlay(marker);
		
		GEvent.addListener(map, 'click', function(overlay, point) {
			if (overlay) {
				// we now need a check here in case the overlay is the info window
				// only our markers will have a .myhtml property
				if (overlay.myhtml) {
					overlay.openInfoWindowHtml(overlay.myhtml);
				}
			} else if (point) {
				//whatever you want to happen if you don't click on an overlay.
			}
		});
		GEvent.trigger(marker, 'click');
	};
	
})(jQuery);

if (typeof google != "undefined") {
	google.load("maps", "2.x");
	google.setOnLoadCallback(gMapInitialize);
}

