var fsize = $.cookie('fsize');

$(function(){

	$('ul li:first-child, ol li:first-child').addClass('firstChild');
	$('ul li:last-child, ol li:last-child').addClass('lastChild');
	$('table th:first-child, table td:first-child').addClass('firstChild');
	$('table th:last-child, table td:last-child').addClass('lastChild');

	$('#fontNav1').click(
	function() {
		$('#fontNav li span').removeClass('active');
		$('#fontNav li#fontNav1 span').addClass('active');
		$('#bodySec').css('font-size','1em');
		$.cookie("fsize",'1em', {expires: 365, path: '/'});
		return false;
	});

	$('#fontNav2').click(
	function() {
		$('#fontNav li span').removeClass('active');
		$('#fontNav li#fontNav2 span').addClass('active');
		$('#bodySec').css('font-size','1.3em');
		$.cookie("fsize",'1.3em', {expires: 365, path: '/'});
		return false;
	});

	$('#gNaviSec ul li a img').not('#gNaviSec ul li a.current img, #gNaviSec ul li a.parentsLink img').hover(
	function(){
		$(this).stop(true,true).css("opacity", "0.6").css("filter", "alpha(opacity=60)");
	},
	function(){
		$(this).fadeTo('fast', 1.0);
	});

	$('#banner-list li a img').hover(
	function(){
		$(this).stop(true,true).css("opacity", "0.6").css("filter", "alpha(opacity=60)");
		$(this).fadeTo('slow', 1.0);
	},
	function(){
	});

	$('#newsTable tr, #irTable tr').each(function(){
		var pass = 14;

		var currentDate = new Date();

		var strTime = $(this).children('td:first-child').text();

		strTime = strTime.replace('年', '');
		strTime = strTime.replace('月', '');
		strTime = strTime.replace('日', '');

		var datetime = new Date();

		datetime.setTime(datetime.getTime()-(pass*(24*60*60*1000)));

		var year = datetime.getFullYear();

		var month = datetime.getMonth() + 1;

		if(month <10) {

			month = '0'+month;

		}

		var day = datetime.getDate();

		if(day <10) {

			day = '0'+day;

		}

		var nexttime = year+''+month+''+day;

	        if(parseInt(strTime) >= parseInt(nexttime)){
//			$(this).children('td').next().addClass('new-icon');
			$(this).children('td:last-child').addClass('new-icon').append('<span class="color_r b">NEW</span>');
	        }

	});


});

$(window).load(function(){

if(fsize != null) {
	if(fsize == "1em") {
		$('#fontNav1').trigger('click');
	}
	if(fsize == "1.3em") {
		$('#fontNav2').trigger('click');
	}
}
else {
	$('#fontNav1').trigger('click');
}

});

