/* snaviアコーディオン */
$(function(){
	$("li.op > a").each(function(index){
		$(this).next().hide();
		$(this).mouseover(function(){
			$(this).next().slideDown();
			return false;
		});
	});
});

/* QAアコーディオン */
$(function(){
	$('.qaHead').click(function() {
		$(this).next().slideToggle(200);
	}).next().hide();
});

/* QAアコーディオン（全て開閉） */
$(function(){
	$('.qaAllOpen').toggle(function() {
		$('.qaBox p').slideDown(200);
		$(this).html("全て閉じる");
	}, function() {
		$('.qaBox p').slideUp(200);
		$(this).html("全て開く");
	});
});

/* リンク効果 */
$(function(){
	$('a').not('.featureImg').hover(function(){
			$(this).css({opacity:0});
			$(this).stop().animate({opacity:0.9},200);
	}, function() {
		$(this).css({opacity:0.5});
		$(this).stop().animate({opacity:1},1000);
	});
	$('#gnavi a').hover(function(){
		$(this).css({opacity:0});
		$(this).stop().animate({opacity:0.6},600);
	}, function() {
		$(this).stop().animate({opacity:1},1000);
	});
});

/* 画像シェイク */
$(function(){
	$('.imgShake').mouseover(function(){
		for (var i=0; i<4; i++) {
			$(this).find('img').animate({marginLeft:'3px'},32);
			$(this).find('img').animate({marginLeft:'0'},32);
		};
	});
});

/* 画像内サムネイル拡大縮小 */
$(function(){
	$('.productThumb img').hover(function(){
		$(this).stop().siblings().not(this).hide().css('z-index','-1');
		$(this).stop().animate({width:'316px',height:'316px'},200);
	}, function() {
		$(this).stop().siblings().not(this).show().css('z-index','0');
		$(this).stop().animate({width:'60px',height:'60px'},200);
	});
});

/* テキストエリア自動リサイズ */
function textareaResize(ev){
    //if (ev.keyCode != 13) return;
    var textarea = ev.target || ev.srcElement;
    var value = textarea.value;
    var lines = 1;
    for (var i = 0, l = value.length; i < l; i++){
        if (value.charAt(i) == '\n') lines++;
     }
     textarea.setAttribute("rows", lines);
     // window.status = lines;
}

/* imagecaptions */
$(function(){
	$('.captionBox').hover(function(){
		$(".caption", this).stop().animate({bottom:'0px'},{queue:false,duration:200});
	}, function() {
		$(".caption", this).stop().animate({bottom:'-50px'},{queue:false,duration:500});
	});
});

