
JELLY.addEvent(window, 'unload', function () {
	GUnload();
});

function GoogleMap(pos_1_LatLng, pos_2_LatLng, window_html) {

	if (GBrowserIsCompatible()) {
		var map = new GMap2(document.getElementById("map_canvas"));
		map.setCenter(new GLatLng(pos_1_LatLng[0], pos_1_LatLng[1]), 16);
		map.addControl(new GSmallZoomControl());
		
		var baseIcon = new GIcon();
		baseIcon.shadow = "../_assets/images/skin/google-map/shadow.png";
		baseIcon.iconSize = new GSize(38, 48);
		baseIcon.shadowSize = new GSize(42, 49);
		baseIcon.iconAnchor = new GPoint(17, 48);
		baseIcon.infoWindowAnchor = new GPoint(17, 48);
		
		function createMarker(point) {
			var myIcon = new GIcon(baseIcon);
			myIcon.image = "../_assets/images/skin/google-map/pointer.png";
			
			markerOptions = { icon:myIcon };
			var marker = new GMarker(point, markerOptions);
			
			GEvent.addListener(marker, "click", function() {
				clearTimeout(timer);
				marker.openInfoWindowHtml(window_html);
				var timer = setTimeout(function () {
					map.panTo(new GLatLng(pos_2_LatLng[0], pos_2_LatLng[1]));
					}, 500);
			});
			return marker;
		}
		var latlng = new GLatLng(pos_1_LatLng[0], pos_1_LatLng[1]);
		map.addOverlay(createMarker(latlng));
	}
}

