// JavaScript Document
var kakoImg =0;

$(function(){
	//GNaviにマウスをのせたときの挙動
	$("#navArea ul li a").hover(
		function(){
			$(this).animate({backgroundPosition:"0px -15px"},200);
		},
		function(){
			$(this).stop(true,false).animate({backgroundPosition:"0px 0px"},300);
		}
	);
		
	//商品ブロックにマウスのせたときの挙動
	$(".productBlock").hover(
		function(){
			$(".imgBlock",this).stop(true,false).animate({"left":"-150px"},300);
		},
		function(){
		$(".imgBlock",this).stop(true,false).animate({"left":"0px"},300);
		}
	);
	/*
	$(".BtnOutdoorItemList a").hover(
		function(){
			$(this).stop(true,false).animate({backgroundPosition:"-300px 0px"},300);
		},
		function(){
		$(this).stop(true,false).animate({backgroundPosition:"0px 0px"},300);
		}
	);
	*/
	//ページトップをクリックしたときの挙動
	$(".pagetop a").click(function(){
		$('html,body').animate({ scrollTop: $($(this).attr("href")).offset().top },"slow",'easeOutQuint');
		return false;
	});
	//初期表示時に商品画像が小さい場合用
	if($(".imgMainBlock ul li:eq(0) img").height()<500){
		$(".imgMainBlock ul li:eq(0)").css("margin-top",(500-$(".imgMainBlock ul li:eq(0) img").height())/2);
	}
	//商品詳細でサムネイルクリックしたときの挙動
	$(".imgMainBlock ul li").css("display","none");
	$(".imgMainBlock ul li:eq(0)").css("display","block");
	$(".imgThumbBlock ul li").click(function(){
		var index =  $(".imgThumbBlock ul li").index(this)
		//古いほうを消して
		$(".imgMainBlock ul li:eq("+kakoImg+")").css("display","none");
		$(".imgThumbBlock ul li:eq("+kakoImg+")").removeClass();
		//新しいほうを表示して

		$(".imgMainBlock ul li:eq("+index+")").css("display","block");
		//vertical-alignを縦位置中央にするため
		if($(".imgMainBlock ul li:eq("+index+") img").height()<500){
			$(".imgMainBlock ul li:eq("+index+")").css("margin-top",(500-$(".imgMainBlock ul li:eq("+index+") img").height())/2);
		}
		
		$(this).addClass("current");
		//kakoImgにindexを代入して古い番号を保存
		kakoImg = index;
	});
	
		
});

