// フォントサイズ変更

$(function(){
  var fontSize = $.cookie('fontSize');
  
  var notie = $.support.leadingWhitespace;
  
  if (fontSize == 'sizeL') {
    if(!notie) {
      $('#container').css('font-size', '120%');
    } else {
      $('#container').css('font-size', '120%');
    }
    $('dd#header-a-textsize-l a img').attr('src', 'http://sinkin-chiiki-lab.jp/common/header_textsize_l_on.gif');
    $('dd#header-a-textsize-s a img').attr('src', 'http://sinkin-chiiki-lab.jp/common/header_textsize_s.gif');
  } else {
    if(!notie) {
      $('#container').css('font-size', '105%');
    } else {
      $('#container').css('font-size', '100%');
    }
    $('dd#header-a-textsize-s a img').attr('src', 'http://sinkin-chiiki-lab.jp/common/header_textsize_s_on.gif');
    $('dd#header-a-textsize-l a img').attr('src', 'http://sinkin-chiiki-lab.jp/common/header_textsize_l.gif');
  }
  
  $("#header-a-textsize-s a").click(function(ev) {
    if(!notie) {
      $('#container').css('font-size', '105%');
    } else {
      $('#container').css('font-size', '100%');
    }
    $.cookie('fontSize', 'sizeS');
    $('dd#header-a-textsize-s a img').attr('src', 'http://sinkin-chiiki-lab.jp/common/header_textsize_s_on.gif');
    $('dd#header-a-textsize-l a img').attr('src', 'http://sinkin-chiiki-lab.jp/common/header_textsize_l.gif');
	});
	
	$("#header-a-textsize-l a").click(function(ev) {
    if(!notie) {
      $('#container').css('font-size', '120%');
    } else {
      $('#container').css('font-size', '120%');
    }
    $.cookie('fontSize', 'sizeL');
    $('dd#header-a-textsize-l a img').attr('src', 'http://sinkin-chiiki-lab.jp/common/header_textsize_l_on.gif');
    $('dd#header-a-textsize-s a img').attr('src', 'http://sinkin-chiiki-lab.jp/common/header_textsize_s.gif');
	});
});

// スムーススクロール
jQuery.easing.quart = function (x, t, b, c, d) {
    return -c * ((t=t/d-1)*t*t*t - 1) + b;
};  
$(document).ready(function(){
  $('a[href*=#]').click(function() {
    if (this.href.match('#calendar')) {
      return false;
    } else {
      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}, 600, 'quart');
         return false;
        }
      }
    }
  });
});

