﻿/****************************************
[jquery] jquery.smartrollover.js
****************************************/

jQuery(document).ready(function(){
	jQuery('a img').hover(function(){
		jQuery(this).attr('src', jQuery(this).attr('src').replace('_off', '_on'));},
			function(){
				if (!jQuery(this).hasClass('currentPage')) {
					jQuery(this).attr('src', jQuery(this).attr('src').replace('_on', '_off'));
		}
	});
});

/**
 * ページ内リンクスクロール
 * 20110222 Konno
 */

//Easingの追加
jQuery.easing.quart = function (x, t, b, c, d) {
    return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

//ページ読み込み中

jQuery(document).ready(function(){

	jQuery('a[href*=#]').click(function() {
        if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
            var $target = jQuery(this.hash);
            $target = $target.length && $target || jQuery('[name=' + this.hash.slice(1) +']');
            if ($target.length) {
                var targetOffset = $target.offset().top;
                jQuery('html,body').animate({ scrollTop: targetOffset }, 500, 'quart');
                return false;
            }
        }
    });
});


/**
 * external link for WordPress
 * 20110729 Konno
 */
jQuery(document).ready( function () {
	jQuery('a[href^=http]:not(:has(img))').not('[href*="'+location.hostname+'"]').addClass('external');
	jQuery('a[href^=http]').not('[href*="'+location.hostname+'"]').attr('target','_blank');
	});


/**
 * Tab
 * 20111027 Konno
 */
jQuery(document).ready( function () {
	jQuery("#tab li").click(function() {
		var num = jQuery("#tab li").index(this);
		jQuery(".content_wrap").addClass('disnon');
		jQuery(".content_wrap").eq(num).removeClass('disnon');
		jQuery("#tab li").removeClass('select');
		jQuery(this).addClass('select')
	});
});

/**
 * Tab
 * 20111027 Konno
 */
jQuery(document).ready( function () {
	jQuery(".image").click(function() {
	var image = jQuery(this).attr("rel");
	jQuery('#image').hide();
	jQuery('#image').fadeIn('slow');
	jQuery('#image').html('<img src=\"' + image + '\"/>');
	return false;
		});
	});

/**
 * Add bgSwitcher
 * 20111120 Konno
 */
jQuery(document).ready( function () {
	jQuery('#mainvisual strong').bgSwitcher({
		images: ['/wp-content/themes/heath/images/visual/img_main_001.jpg', '/wp-content/themes/heath/images/visual/img_main_002.jpg', '/wp-content/themes/heath/images/visual/img_main_003.jpg', '/wp-content/themes/heath/images/visual/img_main_004.jpg', '/wp-content/themes/heath/images/visual/img_main_005.jpg'],
		interval: 5000
	});
});
