function changePage(Id, Section, Page) {
	$('#'+Id+' .Page').hide();
	$('#'+Id+' #'+Id+'_Page_'+Section+'_'+Page).show();
}

function changeSection(Self, Id, Section) {
	$(Self).parent().children().removeClass('Open');
	$(Self).addClass('Open');

	$('#'+Id+' .Section').hide();
	$('#'+Id+' #'+Id+'_Section_'+Section).show();
	$('#'+Id+' .Page').hide();
	$('#'+Id+' #'+Id+'_Page_'+Section+'_0').show();
}

var NowPage = new Array();

function autoPageChange(Id, Delay) {
	$('#'+Id+' .Page').hide();
	if(NowPage[Id] == undefined) NowPage[Id] = 0;
	NowPage[Id]++;
	if($('#'+Id+'_Page_0_'+NowPage[Id]).html()) {
		$('#'+Id+'_Page_0_'+NowPage[Id]).show();
	} else {
		$('#'+Id+'_Page_0_0').show();
		NowPage[Id] = 0;
	}
	
	setTimeout("autoPageChange('"+Id+"', '"+Delay+"')", Delay);
}

function movePage(Id, Direction, TotalPage) {
	$('#'+Id+' .Page').hide();
	if(NowPage[Id] == undefined) NowPage[Id] = 0;
	switch(Direction) {
		case "prev":
			NowPage[Id]--;	
			FLPage = TotalPage;
			break;
		case "next":
			NowPage[Id]++;
			FLPage = TotalPage;
			break;
	}

	if($('#'+Id+'_Page_0_'+NowPage[Id]).html()) {
		$('#'+Id+'_Page_0_'+NowPage[Id]).show();
	} else {
		switch(Direction) {
			case "prev":
				$('#'+Id+'_Page_0_0').parent().children('.Page:last').show();
				NowPage[Id] = $('#'+Id+'_Page_0_0').parent().children('.Page:last').attr('title');
				break;
			case "next":
				$('#'+Id+'_Page_0_0').show();
				NowPage[Id] = 0;
		}
	}
}

$(document).ready(function() {
	$('.CaptureBBSSideArrow').css('padding-top', (parseInt($('.CaptureBBSSideArrow').parent().innerHeight())/2)-6);
});