/* iepngfix */
$(function() {
	$("img[src$=png],.iepngfix").pngfix();
});

/* pageScroll */
jQuery.easing.quart = function (x, t, b, c, d) {return -c * ((t=t/d-1)*t*t*t - 1) + b;};
$(function(){
	$('a.scroll').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
			var $target = $(this.hash);
			$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
			if ($target.length) {
				var targetOffset = $target.offset().top;
				$('html,body').animate({ scrollTop: targetOffset }, 1200, 'quart');
				return false;
			}
		}
	});
});

/*外部リンクを別ウインドウで表示*/
$(function(){
	var myDomain = document.URL.split('/')[2];
	$('#contents a[href^="http://"]'||'a[href^="https://"]').each(function(){
			var urls = $(this).attr('href');
			var extra = urls.split('/')[2];
			if(!extra.match(myDomain)){
				$(this).attr('target','_blank');
				$(this).not($(this).find('img').parents('a')).addClass('extlink');
			}
	});
	$("a[href$=pdf]").attr('target','_blank');
});


$(document).ready(function() {
 if($.cookie('TEXT_SIZE')) {
	$('body').addClass($.cookie('TEXT_SIZE')); 
 }
 $('#fontSize a').click(function() {
	var textSize = $(this).parent().attr('class');
	$('body').removeClass('smallfont largefont').addClass(textSize);
	$.cookie('TEXT_SIZE',textSize, { path: '/', expires: 10000 });
	return false;
	});
});


/*
$(function(){
	var M_SIZE = '87.5%';
	var L_SIZE = '100%';
	$('body').css("font-size",$.cookie('fontsize'));
	$('#flarge a').css("backgroundPosition",$.cookie('fLarge'));
	$('#fmiddle a').css("backgroundPosition",$.cookie('fMiddle'));

	$('#flarge').click(function(){
		$('#flarge a').css("backgroundPosition","-41px -60px");
		$('#fmiddle a').css("backgroundPosition","0 0");
		$('body').css("font-size",L_SIZE);
		$.cookie("fontsize",L_SIZE,{ path: '/', expires: 3});
		$.cookie("fLarge","-41px -60px",{ path: '/', expires: 3});
		$.cookie("fMiddle","0 0",{ path: '/', expires: 3});
		$.cookie("thWidth","126px",{ path: '/', expires: 3});
		return false;
	});

	$('#fmiddle').click(function(){
		$('#fmiddle a').css("backgroundPosition","0 -60px");
		$('#flarge a').css("backgroundPosition","-41px 0");
		$('body').css("font-size",M_SIZE);
		$.cookie("fontsize",M_SIZE,{ path: '/', expires: 3});
		$.cookie("fMiddle","0 -60px",{ path: '/', expires: 3});
		$.cookie("fLarge","-41px 0",{ path: '/', expires: 3});
		$.cookie("thWidth","116px",{ path: '/', expires: 3});
		return false;
	} );
});

*/
