// JavaScript Document
$(document).ready(function(){
	$('.boxSet').hide();
	$('.boxSet:first').show();
	var pg = 1;
	var final = $('.boxSet').length;
	check();
	$('.b_c_first a').click(function(){
		$('.boxSet:not(:first)').fadeOut();	$('.boxSet:first').fadeIn();
		pg = 1; check();
		window.scrollTo(0, 200);
	});
	$('.b_c_prev a').click(function(){
		$('.boxSet:visible').fadeOut().prev().fadeIn();
		pg--;	check();
		window.scrollTo(0, 200);
	});
	$('.b_c_next a').click(function(){
		$('.boxSet:visible').fadeOut().next().fadeIn();
		pg++;	check();
		window.scrollTo(0, 200);
	});
	$('.b_c_last a').click(function(){
		$('.boxSet:not(:last)').fadeOut();	$('.boxSet:last').fadeIn();
		pg = final;	check();
		window.scrollTo(0, 200);
	});
	function check(){
		if(pg == 1 && pg < final){
			$('.b_c_first a').hide(); $('.b_c_prev a').hide();	
			$('.b_c_last a').show(); $('.b_c_next a').show();
		}else if (pg == final && pg > 1 ){
			$('.b_c_first a').show(); $('.b_c_prev a').show();
			$('.b_c_last a').hide(); $('.b_c_next a').hide();
		}else if (pg == 1 && final == 1){
			$('.b_c_first a').hide(); $('.b_c_prev a').hide();	
			$('.b_c_last a').hide(); $('.b_c_next a').hide();			
		}else{
			$('.b_c_first a').show(); $('.b_c_prev a').show();
			$('.b_c_last a').show(); $('.b_c_next a').show();
		}
		if(final == 0){
			$('.b_c_first a').hide(); $('.b_c_prev a').hide();	
			$('.b_c_last a').hide(); $('.b_c_next a').hide();						
		}
	}	
});
