function switchCarousel(toPage){
	$(".hotList").animate({top:yArray[toPage], duration:600, queue:false});
	nowCarouselPage=toPage;
}

$(document).ready(function(){					   
	switchNav("");
	
	nowCarouselPage=1;
	var visibleAmount=4;
	var unitHeight=60;
	var hotAmount=$(".hotUnit").size();
	var tmpPageAmount=Math.floor(hotAmount/visibleAmount);
	var remainAmount=hotAmount%visibleAmount;
	var pageAmount=(remainAmount==0? tmpPageAmount : (tmpPageAmount+1));
	yArray=[];
	yArray[0]=0;
	for(var i=1; i<=pageAmount; i++){
		yArray[i]=-((unitHeight*visibleAmount)*(i-1));
	}
	if(pageAmount>1 && remainAmount!=0){
		yArray[pageAmount]+=((visibleAmount-remainAmount)*unitHeight);
	}
	
	$(".arrowUp").click(function(){
		if(nowCarouselPage>1){
			switchCarousel(nowCarouselPage-1);
		}else if(nowCarouselPage==1){
			switchCarousel(pageAmount);
		}
		return false;
	});
	$(".arrowDown").click(function(){
		if(nowCarouselPage<pageAmount){
			switchCarousel(nowCarouselPage+1);
		}else if(nowCarouselPage==pageAmount){
			switchCarousel(1);
		}
		return false;
	});
	$(".arrowUp").add($(".arrowDown")).focus(function(){
		$(this).blur();
	});
	
	switchCarousel(nowCarouselPage);
});

