var currentRecord = 0;
var currentDiv = null;
var running = false;
var moveDistance = -760;



function initialize(){
	$('back_arrow').style.display="none";
	$('next_arrow').style.display="block";
	
	if (category > 0){
		moveDistance =  Math.ceil(((category) / 4) - 1) * -760;
		if (moveDistance != 0){
			nextArrow();
		}
		moveDistance = -760;
	}
	
	
	if (totalRecords <= 4)
	{
		$('next_arrow').style.display="none";
	}
	
}

function nextArrow() {
	new Effect.MoveBy('product_move', 0, moveDistance, {duration: 0.5,  transition: Effect.Transitions.slowstop, afterFinish: showNext});
	$('next_arrow').style.display="none";
	currentRecord = currentRecord + 4;
	$('back_arrow').style.display="block";
	
}

function backArrow() {
	new Effect.MoveBy('product_move', 0, 760, {duration: 0.5,  transition: Effect.Transitions.slowstop, afterFinish: showBack});
	$('back_arrow').style.display="none";
	currentRecord = currentRecord - 4;
	$('next_arrow').style.display="block";
}




function showNext()
{
	if (currentRecord < totalRecords - 4) {
		$('next_arrow').style.display="block";
	}
	
}
function showBack()
{
	if (currentRecord >= 4) {
		$('back_arrow').style.display="block";
	}
	
}


function updateRunning(){
		running = false;
}