/* 文字コードはUTF-8 */
$(document).ready(function(){
	var top_tabmenu = $('#top_tabmenu').eq(0);
	var top_content = $('#content').eq(0);
	var top_content_data = new Array();
	$('li', top_tabmenu).each(function(index,elem){
		var link = $('a', elem).attr('href');
		if(link == '/'){
			top_content_data[link] = $(top_content).html();
		}
		$(elem).click(function(){
			$("li a[class='active']", top_tabmenu).attr('class', '');
			$('a', elem).attr('class', 'active');
			if(typeof(top_content_data[link]) != 'undefined'){
				$(top_content).html(top_content_data[link]);
				top_content_init();
				content_init();
			}
			else{
				$(top_content).load(link + ' #content', function(){
					top_content_data[link] = $(top_content).html();
					top_content_init();
					content_init();
				});
			}
			return false;
		});
	});
	top_content_init();
});

top_content_init = function(){
	if($('.content div.event_topics').length > 0){
		$('.content div.event_topics').each(function(index,elem){
			if($(elem).html() == ''){
				var params = $(elem).attr('rel').split(';');
				var id = 'event_topics-' + index;
				$(elem).attr('id',id);
				(new feedreader()).init(id, params[0], params[1], params[2]);
			}
		});
	}
}

