var EventMapWideButton = Class.create({
	/** 初期化 */
	initialize : function() {
		// ボタン
		this.btn = $('mapWideBtn').down('a');
		// 地図側の操作対象要素
		this.M = {
			mapArea : $('mapArea'),
			mapBox  : $('mapBox'),
			map     : $('map')
		}
		// カレンダー側の操作対象要素
		this.C = {
			mapList : $('mapList')
		}
		this.btn.observe('click', (function(e){
			e.stop();
			this.onclick();
			return false;
		}).bind(this));
		
		if(getCookie('eventMapWideButton') == '1') {
			this.closeList();
		}
		else {
			this.openList();
		}
	},
	onclick : function() {
		if(this.C.mapList.style.display == 'none') {
			this.openList();
		}
		else {
			this.closeList();
		}
	},
	openList : function() {
		var btn = this.btn;
		var C   = this.C;
		var M   = this.M;
		var txt = 'イベントリストを隠す';
		btn.removeClassName('narrow');
		btn.addClassName('wide');
		btn.href="javascript:void('"+txt+"')";
		btn.title = txt;
		C.mapList.show();
		M.mapArea.setStyle({width:'465px'});
		M.mapBox.setStyle({width:'453px'});
		M.map.setStyle({width:'453px'});
		if(M.map.gmapTriggerReseize)
			M.map.gmapTriggerReseize();
		setCookie('eventMapWideButton', '0');
	},
	closeList : function() {
		var btn = this.btn;
		var C   = this.C;
		var M   = this.M;
		var txt = 'イベントリストを表示';
		btn.removeClassName('wide');
		btn.addClassName('narrow');
		btn.href="javascript:void('"+txt+"')";
		btn.title = txt;
		C.mapList.hide();
		M.mapArea.setStyle({width:'690px'});
		M.mapBox.setStyle({width:'678px'});
		M.map.setStyle({width:'678px'});
		if(M.map.gmapTriggerReseize)
			M.map.gmapTriggerReseize();
		setCookie('eventMapWideButton', '1');
	}
});

