// topTabControl
var topTabActive = 1;

function topTabAutoSwitchStart() {
	topTabIdol = setInterval(topTabAutoSwitch,3000);
}

function topTabAutoSwitchStop(num) {
	topTabActive = num;
	if(typeof(topTabIdol) !="undefined") { clearInterval(topTabIdol); }
	if(typeof(topTabIdolRestart) !="undefined") { clearTimeout(topTabIdolRestart); }
	topTabIdolRestart = setTimeout(topTabAutoSwitchStart,10000);
}

function topTabAutoSwitch() {
	topTabActive++;
	if (topTabActive >= 4) { topTabActive = 1; }
	topTab(topTabActive);
}

function topTab(num){
	$('#topTabBnr01').hide();
	$('#topTabBnr02').hide();
	$('#topTabBnr03').hide();
	document.getElementById('topTabBnrBtn01').className = "col_01_02_01_02_02";
	document.getElementById('topTabBnrBtn02').className = "col_01_02_01_02_02";
	document.getElementById('topTabBnrBtn03').className = "col_01_02_01_02_02";
	switch (num){
		case 1:
			$('#topTabBnr01').fadeIn('slow');
			document.getElementById('topTabBnrBtn01').className = "col_01_02_01_02_01";
			break;
		case 2:
			$('#topTabBnr02').fadeIn('slow');
			document.getElementById('topTabBnrBtn02').className = "col_01_02_01_02_01";
			break;
		case 3:
			$('#topTabBnr03').fadeIn('slow');
			document.getElementById('topTabBnrBtn03').className = "col_01_02_01_02_01";
			break;
		default:
			break;
	}
}

// bookDetailControl
$(function(){

	$("#bookThumbnailOpenBtn").click(function(){
		$('#bookThumbnailRem').slideDown("slow");
		$(this).hide();
		$(this).next().show();
    });

    $("#bookThumbnailCloseBtn").click(function(){
		$('#bookThumbnailRem').slideUp("slow");
		$(this).hide();
		$(this).prev().show();
    });

	$("#bookReviewOpenBtn").click(function(){
		$('#bookReviewRem').slideDown("slow");
		$(this).hide();
		$(this).next().show();
    });

	$("#bookReviewCloseBtn").click(function(){
		$('#bookReviewRem').slideUp("slow");
		$(this).hide();
		$(this).prev().show();
   });

	$("#bookTrackbackOpenBtn").click(function(){
		$('#bookTrackbackRem').slideDown("slow");
		$(this).hide();
		$(this).next().show();
    });

	$("#bookTrackbackCloseBtn").click(function(){
		$('#bookTrackbackRem').slideUp("slow");
		$(this).hide();
		$(this).prev().show();
   });

});

