/*
 * Google Maps
 *
 * Copyright: (c) 2009 九州旅客鉄道株式会社
 *
 * Depends Script:
 *	google maps api (2.x)
 */

var gmaps = {
	jQuery: $,

	selectors: {
		m_canvas: 'map-canvas'
	},

/* action~ */
	load: function(lat, lng, zoom, title, icon_image, print_icon_image) {
		var gmaps = this,
			selectors = this.selectors;

		if (GBrowserIsCompatible()) {
			var map = new GMap2(document.getElementById(selectors.m_canvas));
			map.setCenter(new GLatLng(lat, lng), zoom);
			map.addControl(new GSmallMapControl());
			map.addControl(new GScaleControl());
			map.addControl(new GMenuMapTypeControl());
			map.enableScrollWheelZoom();
			map.enableContinuousZoom();
			if (icon_image) {
				var icon = new GIcon();
				icon.iconSize = new GSize(37, 45);
				icon.iconAnchor = new GPoint(17,40);
				icon.image = icon_image;
				if (print_icon_image) icon.printImage = print_icon_image;
			}
			if (title || icon) {
				var opt = new Object();
				if (title) opt.title = title;
				if (icon) opt.icon = icon;
				var marker = new GMarker(map.getCenter(), opt);
			} else {
				var marker = new GMarker(map.getCenter());
			}
			map.addOverlay(marker);
		}
	}
/* ~action */
}

$(window).unload(function() {
	GUnload();
});
