

$(document).ready(initApp);

function initApp() {
	
	// jQuery　アコーディオンメニュー用スクリプト star //

	$(".accordionMenu").hide();
	
	$(".accordionMenuRoot .menuTitle").css("cursor", "pointer");
	
	$(".accordionMenuRoot .menuTitle").click(function() {
		$(".accordionMenu", $(this).parent()).slideToggle("normal");
	});
	// jQuery　アコーディオンメニュー用スクリプト end //


	//　jQuery　スムーズスクロール start　//

$('a[href*=#]').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 - 20;  
        $('html,body')  
          .animate({scrollTop: targetOffset}, 1000);  
        return false;  
      }  
    }  
  });  
	//　jQuery　スムーズスクロール end　//
	
	//奇数、偶数を自動追加
	$('ul').each(function(){
		$(this).find('li:odd').addClass('even');
		$(this).find('li:even').addClass('odd');
	});

	$('table').each(function(){
		$(this).find('tr:odd').addClass('even');
		$(this).find('tr:even').addClass('odd');
	});

	//:first-child, :last-childをクラスとして追加
	$(':first-child').addClass('firstChild');
	$(':last-child').addClass('lastChild');
	
}

