$(function(){
	var machineN = $("#lineuplist ul li").length;
	var $paneTarget = $('div#lineuplist');
	var totalPage = Math.ceil(machineN / 6);
	var paneWidth = totalPage * 672 ;
	
	var current = 1;

	$paneTarget.stop().scrollTo( {top:0, left:0});
	$("#lineuplist ul").css("width",paneWidth+"px");
//	$("p#pagenumber span#maxpage").text(totalPage);
//	$("p#pagenumber span#current").text(current);


	if(machineN > 6){

		$("#previous img").hide();
		$("#next img").show();

		$("#next img").click(function(){

						$paneTarget.stop().scrollTo( {top:0, left:'+=672px'}, 400 ,function() {
		 				current = current+1;
						//pagenumber($('p#pagenumber span#current'),current);
						$("#previous img").show();
							if(current == totalPage){
								$("#next img").hide();
							}
						});
						return false;
		});

		$("#previous img").click(function(){

						$paneTarget.stop().scrollTo( {top:0, left:'-=672px'}, 400 ,function() {
		 				current = current-1;
						//pagenumber($('p#pagenumber span#current'),current);
						$("#next img").show();

							if(current == 1){
								$("#previous img").hide();
							}
						});
						return false;
		});
	}
	else{
		$("#next img,#previous img").hide();
	}
});

/*
function pagenumber(j,c) {
  j.text(c);
}
*/