
			
// 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(){
								
	// Image Rollover

	$("img[src*='_on']").addClass("current");

	$("img,input").mouseover(function(){
		if ($(this).attr("src")){
			$(this).attr("src",$(this).attr("src").replace("_off.", "_on."));
		}
	});

	$("img[class!='current'],input").mouseout(function(){
			if ($(this).attr("src")){
				$(this).attr("src",$(this).attr("src").replace("_on.", "_off."));
			}
	});
	

	// External Link
	$("a[rel=external]").click(function(){
		window.open(this.href,"_blank");
		return false;
	});


	//
	// <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;
			}
		}
	});
	
	//イメージマップにもなめらかスクロールを
	jQuery('area[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;
			}
		}
	});
	
	
		
		var arryImgs = ["img/index/img-craft.jpg","img/index/img-bagmaking.jpg","img/index/img-hallmark2.jpg","img/index/img-eco.jpg","img/index/img-ethnic.jpg"];
		var arrylink=["product/limited2011_07/craft.html","product/limited2011_07/bagmaking.html","product/limited2011_07/hallmark2.html","product/limited2011_07/eco-tawashi.html","product/limited2011_07/ethnic.html"];
		var arryalt=["話題のクラフト お子様向けの夏休みの宿題にもおすすめの楽しいクラフトをご紹介します。","バッグメイキング 夏におすすめのバッグ素材についてご紹介します。","ホ－ルマ－クコラボプリントⅡ「ホールマーク」「ルシアン」「パンドラハウス」コラボ商品第２弾の布地とワッペンなどの小物をご紹介。","環境月間エコタワシを作ろう ６月の環境月間にアクリル毛糸で作るエコタワシをご紹介。","エスニックスタイル ボイルプリントを中心に親子のエスニックスタイルをご紹介します。"];
		var times = 2;
		
		function changeImage(){
			if (times == 6) {
				times = 1;
			}
			$("#syohin ul li a").removeClass("current");
			$("#syohin ul li a").eq(times-1).addClass("current");
			$("#play_img img").filter(":visible").fadeOut("slow",function(){
					$("#play_img img").eq(times-2).fadeIn("slow");	
			 });
			times++;
			
		}
		var interval = window.setInterval(function(){
			changeImage();
		}, 6000);
		
     
	
	  $("#syohin ul li a").each(function(index){
			$(this).click(function(){
					$("#syohin ul li a").removeClass("current");
		            $(this).addClass("current");
					$("#play_img img").filter(":visible").fadeOut("slow",function(){
						 $("#play_img img").eq(index).fadeIn("slow");									   
					 });
					times = index+2;
					clearInterval(interval);
					interval = window.setInterval(function(){
						changeImage();
					}, 6000);
			});
			
		});
	
	  $(".new_left img").click(function(){
		 $(".new_right img").attr("src",$(".new_right img").attr("src").replace("_hover.","_out."));
		 $(this).attr("src",$(this).attr("src").replace("_out.","_hover."));
		 $("#news img").removeClass("current");
		 $(this).addClass("current");
		 $("#tag_1").show();
		 $("#tag_2").hide();
	  });
	  
	   $(".new_right img").click(function(){
		 $(".new_left img").attr("src",$(".new_left img").attr("src").replace("_hover.","_out."));	
		 $(this).attr("src",$(this).attr("src").replace("_out.","_hover."));
		 $("#news img").removeClass("current");
		 $(this).addClass("current");
		 $("#tag_1").hide();
		 $("#tag_2").show();
	  });
	   
	  
	      $("#news img").each(function(){
				$(this).hover(
					function(){
					  if($(this).hasClass("current")==false){
						 $(this).attr("src",$(this).attr("src").replace("_out.","_hover."));
					  }
					},
					function(){
						if($(this).hasClass("current")==false){
						   $(this).attr("src",$(this).attr("src").replace("_hover.","_out."));
						}
					}			  
				);
		});
		  
	$(".toggle_container").hide(); 

	//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
	$("h3.title").click(function(){
		$(this).toggleClass("active").next().slideToggle("slow");
		return false; //Prevent the browser jump to the link anchor
	});
		$("h3.title2").click(function(){
		$(this).toggleClass("active").next().slideToggle("slow");
		return false; //Prevent the browser jump to the link anchor
	});

	 
});


