$(function(){
//検索窓Value（仮）
	$("input[name=word]").val("Search").css("color","#CCC").one("focus",function(){
		$(this).val("").css("color","#333");
	}).blur(function(){
		if($(this).val()==""){
			$(this).val("Search").css("color","#CCC").one("focus",function(){
				$(this).val("").css("color","#333");
			});
		}
	});
//トップページ商品ランナップdiv要素にリンク
	$("div#lineup .box,div#lineup .box2,div#lineup .box3,div#lineup .box4").mouseover(function(){
		$(this).addClass("over");
	}).mouseout(function(){
		$(this).removeClass("over");
	});
	$("div#lineup .box,div#lineup .box2").click(function(){
		window.location=$(this).find("a").attr("href");
		return false;
	});
//検索結果ページdiv要素にリンク
	$("div#result-list .item-box").mouseover(function(){
		$(this).addClass("over");
	}).mouseout(function(){
		$(this).removeClass("over");
	});
	$("div#result-list .item-box").click(function(){
		window.location=$(this).find("a").attr("href");
		return false;
	});
//詳細ページサムネイル＆注釈切り替え
	$(".thumb a img").click(function(){
		$(".main-image img").attr("src",$(this).attr("src"));
		$("#sub-text").text($(this).attr("alt"));
		return false;
	});
//車種一覧タブ化
	$("div.list:not("+$(".syasyu-tab li a.selected").attr("href")+")").hide()
	$(".syasyu-tab li a").click(function(){
		$(".syasyu-tab li a").removeClass("selected");
		$(this).addClass("selected");
		$("div.list").hide();
		$($(this).attr("href")).show();
		return false;
	});

//ロールオーバー
	$("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"));
	});
});

//ページ内スクロール
// 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(){
	//
	// <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;
			}
		}
	});
});

