$(function() {
	var base = $("#listBox").height();
	var target = $("#listBox > ul").height();
	var slideHeight = $("#listBox > ul > li").height() + 21;
	
	//限度位置
	//３つ表示分
	var MaxPos = target - slideHeight*3;
	
	//アニメ処理フラグ
	var flg = true;
	
	//PREV処理　上に
	$("#otherVideoNext").bind("click", function() {
	
		var st = $("#listBox > ul").css("top").indexOf("px");
		var currentNum = $("#listBox > ul").css("top").substring(0,st);
		if(currentNum > -MaxPos && flg == true){
			flg = false;
			//適当な大きさ2px以上ならOK
			if((target - base) > 2){
				$("#listBox > ul").animate({"top": "-=" +slideHeight +  "px"}, "slow", function(){
					flg = true;
				});
			}
		}
	});
	
	//NEXT処理　下に
	$("#otherVideoPrev").bind("click", function() {
	
		var st = $("#listBox > ul").css("top").indexOf("px");
		var currentNum = $("#listBox > ul").css("top").substring(0,st);
		
		if(currentNum < 0 && flg == true){
			flg = false;
			$("#listBox > ul").animate({"top": "+=" +slideHeight +  "px"}, "slow", function(){
					flg = true;
			});
		}		
	});
	
	
});

