Ramen.setup = function() {
    	//Ramen.Gmap.setup();
	
	jQuery('.infoRamen').each(function() {
		Ramen.ToggleRamenInfo.setup('#' + jQuery(this).attr('id'));
	});
	
	Ramen.ShopImages.setup();
};

/**********************************************************
印刷用Google Map
**********************************************************/
Ramen.Gmap = (function() {
	var container = '#GmapPrint';
	var lat;
	var lon;
	var control;
	var zoom;

	return {
		setup: function() {
			if (!GBrowserIsCompatible()) return;
			jQuery(window).unload(GUnload);
			var conf = (jQuery(container).attr('gmapconf')).split(',');

			lat = parseInt(conf[0]) / 3600000.0;
			lon = parseInt(conf[1]) / 3600000.0;

			control = conf[2];
			zoom = parseInt(conf[3]);
			
			Ramen.Gmap.show();
		},

		map_refresh: function() {
			var map = new GMap2(jQuery(container).get(0));
			if (control == 'small')
				map.addControl(new GSmallMapControl());
			else if (control == 'large')
				map.addControl(new GLargeMapControl());
			var point = new GLatLng(lat, lon);
			map.addOverlay(new GMarker(point));
			map.setCenter.apply(map, [point, zoom]);
		},
		
		show: function() {
			if (jQuery.browser.opera) return jQuery(Ramen.Gmap.map_refresh);
			jQuery(window).load(function () {
				Ramen.Gmap.map_refresh()
			});
		}
	};
})();

/**********************************************************
おすすめラーメン詳細情報 グラフ／詳細表示切替え
**********************************************************/
Ramen.ToggleRamenInfo = (function() {
	return {
		setup: function (container) {
			jQuery(container + ' dd.graph a').click(function () {
				Ramen.ToggleRamenInfo.showGraph(container);
			});
		},

		showDetail: function (container) {
			jQuery(container + ' .chart').hide();
			jQuery(container + ' dd.graph').html('<a href="javascript://">グラフ</a>');
			jQuery(container + ' dd.graph a').click(function () {
				Ramen.ToggleRamenInfo.showGraph(container);
			});
			jQuery(container + ' table').show();
			jQuery(container + ' dd.detail').html('詳細');
		},

		showGraph: function (container) {
			jQuery(container + ' .chart').show();
			jQuery(container + ' dd.graph').html('グラフ');
			jQuery(container + ' table').hide();
			jQuery(container + ' dd.detail').html('<a href="javascript://">詳細</a>');
			jQuery(container + ' dd.detail a').click(function () {
				Ramen.ToggleRamenInfo.showDetail(container);
			});
		}
	};
})();

/**********************************************************
店舗画像ligthboxセット
**********************************************************/
Ramen.ShopImages = (function() {
	return {
		setup: function() {
			if (!jQuery('#shopImages').size()) return;
			jQuery('#shopImages a').lightBox();
		}
	};
})();


