var canvas = {
	id: '',
	load: function() {
		//--------------------
		// 캔버스 로드하기
		//--------------------
		var me = $('#map');
		$("#map_resizer_open").css('cursor','s-resize').bind('mousedown', function(e) {
			var h = me.height();
			var y = e.clientY;
			var movehandler = function(e) {
				me.height(Math.max(h, e.clientY + h - y));
				google.maps.event.trigger(map, 'resize');
			};
			var uphandler = function(e) {
				$('html').unbind('mousemove',movehandler).unbind('mouseup',uphandler);
			};
			$('html').bind('mousemove', movehandler).bind('mouseup', uphandler);
		});

		try {
			after_canvas_load();
		}
		catch(e) {
		}
	},
	show: function() {
		var m = $('#map');
		m.slideDown("slow",function() {
			//-------------------------
			// 지도 크기 조절 핸들러
			//-------------------------
			$("#map_resizer_close").css({'background-image':'url(/hotel/images/bg_map_resizer.gif)','background-position':'center center','background-repeat':'no-repeat','cursor':'s-resize'})
				.bind('mousedown', function(e) {
					var h = m.height();
					var y = e.clientY;
					var movehandler = function(e) {
						m.height(Math.max(360, e.clientY + h - y));
						google.maps.event.trigger(map, 'resize');
					};
					var uphandler = function(e) {
						$('html').unbind('mousemove',movehandler).unbind('mouseup',uphandler);
					};
					$('html').bind('mousemove', movehandler).bind('mouseup', uphandler);
			});
			$('#mapmenu_wrap_init').slideUp('fast',function() {
				$('#mapmenu_wrap_toggle').slideDown('fast',function() {
					$('#spot_icon_group').slideDown('fast',function() {
					});
				});
			});
			try {
				after_canvas_load();
			}
			catch(e) {
			}
		});
	},
	open: function() {
		//----------------
		// 캔버스 열기
		//----------------
		$('#map').slideDown('normal',function() {
			$('#canvas_cmd_toggle').css({'background':'url(/hotel/images/bg_mapmenu_icon.gif) no-repeat left -92px'}).text('Close Map');
			$('#spot_icon_group').slideDown('fast');
			google.maps.event.trigger(map, 'resize');
		});
	},
	close: function() {
		//----------------
		// 캔버스 닫기
		//----------------
		$('#map').slideUp('normal',function() {
			$('#canvas_cmd_toggle').css({'background':'url(/hotel/images/bg_mapmenu_icon.gif) no-repeat left -142px'}).text('Open Map');
			$('#spot_icon_group').slideUp('fast');
			google.maps.event.trigger(map, 'resize');
		});
	},
	toggle: function() {
		//--------------------------
		// 캔버스 열기/닫기 토글
		//--------------------------
		//$('#map').slideToggle();
		if($('#map').css('display') == 'none') {
			this.open();
		}
		else {
			this.close();
		}
		google.maps.event.trigger(map, 'resize');
	},
	resize: function(amount) {
		var m = $('#map');
		var height = m.height() + amount;
		var display = 'block';
		if(height < 1) {
			height = 0;
			display = 'none';
		}
		m.height(height).css({'display':display});
		google.maps.event.trigger(map, 'resize');
	},
	maximize: function() {
		//-----------------------
		// 캔버스 최대화 토글
		//-----------------------
		var m = $('#map');
		var height = 360;
		if(m.height() == height) {
			height = $(window).height() - 150;
			$('#canvas_cmd_fullscreen').css({'background':'url(/hotel/images/bg_mapmenu_icon.gif) no-repeat left -49px'}).text('Base Screen');
		}
		else {
			$('#canvas_cmd_fullscreen').css({'background':'url(/hotel/images/bg_mapmenu_icon.gif) no-repeat left 1px'}).text('Full Screen');
		}
		m.height(height).css({'display':'block'});
		//if(map) map.setCenter(new google.maps.LatLng(clat, clng), czoom);
		google.maps.event.trigger(map, 'resize');
	},
	show_zoomlevel: function() {
		//-----------------------
		// 지도 줌레벨 표시하기
		//-----------------------
		var div = document.getElementById('canvas_txt_zoomlevel');
		if(div) div.innerHTML = 'Level '+map.getZoom();
	}
}

