/*
 * スムーズアンカーリンク
 */
//させない場合はクラスにnoscrollを記述
$(function(){
    $('a[href*=#], area[href*=#]').not('a.noscroll[href*=#], area.noscroll[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;
                $('html,body').animate({scrollTop: targetOffset}, 500);
                return false;
            }
        }
    });
});


//---------------------------------------------------------------------

/*
 * 別窓表示
 */
//aタグにclass="blank"
$(function(){
  $('a.blank').click(function(){
    window.open(this.href);
    return false;
  })
});


//---------------------------------------------------------------------

/*
 * 画像ロールオーバー
 */
//class="imgrollover"で設定
//拡張子に_onと_crがついている場合はロールオーバーしない
$(function(){
	var postfix = '_on';//マウスオーバー
	var currentfix = '_cr';//現在位置
	$('.imgrollover a img,  a.imgrollover img, img.imgrollover, .submenu a img').not('[src*="'+ postfix +'."], [src*="'+ currentfix +'."]').each(function() {
		var img = $(this);
		var src = img.attr('src');
		var src_on = src.substr(0, src.lastIndexOf('.'))
		           + postfix
		           + src.substring(src.lastIndexOf('.'));
		$('<img>').attr('src', src_on);
		img.hover(
			function() {
				img.attr('src', src_on);
			},
			function() {
				img.attr('src', src);
			}
		);
	});
});


//---------------------------------------------------------------------

/*
 * first-child、last-childを有効にする
 */
//class="fl-check"
$(function() {
		$( '.fl-check :first-child' ).addClass( 'firstChild' );
		$( '.fl-check :last-child' ).addClass( 'lastChild' );
});


//---------------------------------------------------------------------

/*
 * stripe
 */
//class="stripe"を指定した<tr>と<li>
//偶数、奇数でそれぞれeven,oddのクラスが追加される
$(function(){
	$(".stripe tr:nth-child(even) , .stripe li:nth-child(even)").addClass("even");
	$(".stripe tr:nth-child(odd) , .stripe li:nth-child(odd)").addClass("odd");
});



