$(function(){

	//=================================
	// サムネイルアクション
	var thumb_img = $('#thumbImageOutline li img');
	thumb_img.eq('0').addClass('NowShowMain').css('border-color','#990000');

	thumb_img.click(function(){
		if( $(this).hasClass("NowShowMain") ){ return; } // MAIN表示しているものは対象外
		thumb_img.filter(".NowShowMain").removeClass('NowShowMain').css('border-color','#666666');
		$(this).addClass("NowShowMain");
	});

	thumb_img.hover(
		function(){
			$(this).css('border-color','#990000');
		},
		function(){
			if( $(this).hasClass("NowShowMain") ){ return; } // MAIN表示しているものは対象外
			$(this).css('border-color','#666666');
		}
	);


	//=================================
	// ギャラリーエフェクト
	$('#mainImageOutline').cycle({

		fx: 'fade',
		speed: 800,
		timeout: 5000,
		prev: '#prevLabel',
		next: '#nextLabel',
		pager: '#thumbImageOutline',
		pagerAnchorBuilder: function(idx, slide) {
			return '#thumbImageOutline li:eq(' + idx + ') a';
		},
		// 画像変更前にキャプションを隠し、ボーダーカラー変更
		before: function (curr, next, opts, flg) {
			if( curr.src==next.src ){ return; } // 表示中のものと同じ場合は何もしない
			$('#picture_comment').text('');
			opts.cssBefore = { left:(430-next.cycleW)/2 };
			thumb_img.filter(".NowShowMain").removeClass('NowShowMain').css('border-color','#666666');
			$('#thumbImageOutline li:eq(' + opts.nextSlide + ') img').addClass('NowShowMain').css('border-color','#990000');
		},
		// 画像変更後にキャプションを出す
		after: function (curr, next, opts) {
			var thumb_alt = $('#thumbImageOutline li:eq(' + opts.currSlide + ') img').attr("alt");
			$('#picture_comment').text(thumb_alt);
		}

	}).cycle('pause'); // 最初は PAUSE


	//=================================
	// PLAYボタン押下処理
	$('#playLabel').click(function(){
		$('#mainImageOutline').cycle('resume', true);
		$(this).hide();
		$('#pauseLabel').show();
	});


	//=================================
	// PAUSEボタン押下処理
	$('#pauseLabel').click(function(){
		$('#mainImageOutline').cycle('pause');
		$(this).hide();
		$('#playLabel').show();
	});


});


//=================================
// ギャラリータブの切替処理
function GetMenu( show_id ) {

	$("div.getlist").each(function(){
		if( $(this).attr("id")==show_id ){
			$(this).show();
		}else{
			$(this).hide();
		}
	});

}



