$(function(){
//ロールオーバー
	$("img.swap").mouseover(function(){
		$(this).attr("src",$(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_on$2"));
	}).mouseout(function(){
		$(this).attr("src",$(this).attr("src").replace(/^(.+)_on(\.[a-z]+)$/, "$1$2"));
	});


//トップページdiv要素にリンク
	$("div#main .box").mouseover(function(){
		$(this).addClass("over");
	}).mouseout(function(){
		$(this).removeClass("over");
	});
	$("div#main .box").click(function(){
		window.location=$(this).find("a").attr("href");
		return false;
	});
//トップページdiv要素にリンク
	$("div#photo-area").mouseover(function(){
		$(this).addClass("over");
	}).mouseout(function(){
		$(this).removeClass("over");
	});
	$("div#photo-area").click(function(){
		window.location=$(this).find("a").attr("href");
		return false;
	});
//施工事例BOXにリンク
	$(".syohin_box").mouseover(function(){
		$(this).addClass("over");
	}).mouseout(function(){
		$(this).removeClass("over");
	});
	$(".syohin_box").click(function(){
		window.location=$(this).find("a").attr("href");
		return false;
	});
//施工事例メニューにリンク
	$(".cate_table td").mouseover(function(){
		$(this).addClass("over");
	}).mouseout(function(){
		$(this).removeClass("over");
	});
	$(".cate_table td").click(function(){
		window.location=$(this).find("a").attr("href");
		return false;
	});
});


//ページ内スクロール
// Easingの追加
jQuery.easing.quart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

$(document).ready(function() {
	$(".yearlyList ol").css("display","none");
	$(".yearlyList").click(function(){
		$(this).children().slideToggle("slow");
	});
});
/*-------------------------------------
 ページ読み込み中
-------------------------------------*/
jQuery(document).ready(function(){
	//
	// <a href="#***">の場合、スクロール処理を追加
	//
	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 }, 1200, 'quart');
				return false;
			}
		}
	});
});

// iPhoneまたは、Androidの場合は振り分けを判断
/*
if (document.referrer.indexOf('kyutouki.net') == -1 && ((navigator.userAgent.indexOf('iPhone') > 0 && navigator.userAgent.indexOf('iPad') == -1) || navigator.userAgent.indexOf('iPod') > 0 || navigator.userAgent.indexOf('Android') > 0)) {
    if(confirm('アクセスありがとうございます！\nこのサイトにはスマートフォン用のサイトがあります。\n表示しますか？')) {
        location.href = 'http://www.kyutouki.net/sp/';
    }
}
*/
