//<![CDATA[
	// Initializing main variables
	var map;
	var zoom = 14;

	// FlyTo function - allows us to fly to certein point with slow nice move.
	function flyTo(iBusinessId) {
		function subGPoints(a,b) { return new GPoint(a.x-b.x, a.y-b.y); }
		//Pixel distance to the center of the map
		var CDivPixel = map.fromLatLngToDivPixel(map.getCenter());
		//Pixel distance from the marker point
		var pointDivPixel = map.fromLatLngToDivPixel(marker.getLatLng());
		//Difference between the above mentioned distances
		var fromCenter = subGPoints(pointDivPixel, CDivPixel);
		//Pan to the corrected location (the -40 and +215 sizes are the distances from my marker to the center of the infowindow
		map.panBy(new GSize((fromCenter.x*(-1))-50,(fromCenter.y*(-1))+90));
	}
		
	// Initialize Google Map
	function initializeGoogleMaps() {
		if (GBrowserIsCompatible()) {
			// create marker icon
			var baseIcon = new GIcon();
			
			baseIcon.image = "logic_frontend/templates/site/images/googlemaps/marker3.gif";
			//http://maps.gstatic.com/intl/pl_pl/mapfiles/markerTransparent.png
			
			baseIcon.iconSize = new GSize(24, 24);
			baseIcon.iconAnchor = new GPoint(12, 12);
			baseIcon.infoWindowAnchor = new GPoint(12, 12);
			baseIcon.infoShadowAnchor = new GPoint(12, 12);
			// assign marker icon to marker
			var markerOptions = { icon:baseIcon };
			map = new GMap2(document.getElementById("map"));
			//map.addControl(new GSmallMapControl());
			//map.addControl(new GMapTypeControl());
			var point = new GLatLng(iGoogleLat, iGoogleLng);
			map.setCenter(point, zoom);
			// custom control buttons
			var zin = document.createElement('a');
			var zout = document.createElement('a');
			zin.id = 'zoom_in';
			zout.id = 'zoom_out';
			zin.href = ('javascript:;');
			zout.href = ('javascript:;');
			jQuery('#map_controls_zoomin').append(zin);
			jQuery('#map_controls_zoomout').append(zout);
			GEvent.addDomListener(zin, "click", function(){map.zoomIn();});
			GEvent.addDomListener(zout, "click", function(){map.zoomOut();});
			// create marker
			marker = new GMarker(point, markerOptions);
			marker.bindInfoWindowHtml(markerInfo, {pixelOffset:new GSize(100,100)});
			GEvent.addDomListener(marker,"infowindowopen",  function() {flyTo();});
			// place marker on a map
			map.addOverlay(marker);
		}
	}
	
	jQuery(document).ready(function() { initializeGoogleMaps(); });

//]]>
