// JavaScript Document

// ホームスライドの実行
$(document).ready(function(){	
	$("#home #main-visual").easySlider({
		auto: true, 
		continuous: true,
		controlsShow: false,
		speed: 500,
		pause: 6000
	});
});	

// スクローラー

$(function() {
	$("a[rel='anchor']").click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
			var target = $(this.hash);
			target = target.length && target;
			if (target.length) {
				var sclpos = 30;
				var scldurat = 1200;
				var targetOffset = target.offset().top - sclpos;
				$('html,body')
					.animate({scrollTop: targetOffset}, {duration: scldurat, easing: "easeOutExpo"});
				return false;
			}
		}
	});
});

// ロールオーバー

(function($) {
    $.fn.rollover = function(postfix) {
        postfix = postfix || '-over';
        return this.not('[src*="'+ postfix +'."]').each(function() {
            var img = $(this);
            var src = img.attr('src');
            var src_on = [
                src.substr(0, src.lastIndexOf('.')),
                src.substring(src.lastIndexOf('.'))
            ].join(postfix);
            $('<img>').attr('src', src_on);
            img.hover(
                function() {
                    img.attr('src', src_on);
                },
                function() {
                    img.attr('src', src);
                }
            );
        });
    };
})(jQuery);

// ロールオーバーの実行

jQuery(document).ready(function($)
{
	$('.hover').rollover();
});

// ロールオーバー処理（透過）

$(document).ready(function(){
	$("#home #main-banner a img, #home #sub-banner a img, #bt-mail-magazine a img, #member-navigation li a img, #banner a img").fadeTo(0,1.0);
	$("#home #main-banner a, #home #sub-banner a, #bt-mail-magazine a, #member-navigation li a, #banner a").hover(function(){
        $(this).find("img").fadeTo(0,0.7);
    },
    function(){
        $(this).find("img").fadeTo(0,1.0);
    });
});

