document.observe('dom:loaded', function() {
	if ( $('maturi') ) {
		new Maturi();
	}
});
var Maturi = Class.create({
	no: '01',
	initialize: function() {
		var myDate = new Date();
		var locals = {
		3: 'aomori',
		11: 'akita',
		4: 'iwate', 
		10: 'hokkaido'
		}

		var topNo = $F('topNo');
		this.local = locals[topNo];

		var initTab = Math.ceil( ( myDate.getMonth() + 1 ) / 2 ) ;
		$$('#maturi .tabNavi img').invoke('observe','mouseover',this.onMouseOver.bind(this));
		$$('#maturi .tabNavi img').invoke('observe','click',this.onClick.bind(this));
		var el = $('maturi').down('.tab0' + initTab).down('img');
		this.getSubList.bind(this)(el);
	},
	onClick: function( ev ) {
		var el = ev.element();
		ev.stop();
	},
	onMouseOver: function( ev ) {
		var el = ev.element();
		this.getSubList.bind(this)(el);
	},
	getSubList: function( el ) {
		if ( this.currentImage ) {
			this.currentImage.src = '/main/images/Event/title_' + this.no + '.gif';
		}
		this.currentImage = el;
		this.no = el.src.match(/[0-9]+/);
		el.src = '/main/images/Event/title_' + this.no + '_' + this.local + '_over.gif';

		var url = el.up('a').href;
		new Ajax.Updater('maturiList', url);
	}
});

