currentRowArray = new Object();

function move(name, group, whereTo, numRows, rowPixelHeight, viewPortPixelHeight){
	var nextRow = 0;
	var rowIncrement = 0;
	var currentRow = currentRowArray[group][name];
	var pixelIncrement = 0;
	var tableElement = $('table'+name);
	var topLink = $('top-link'+name);
	var topImage = $('top-image'+name);
	var bottomLink = $('bottom-link'+name);
	var bottomImage = $('bottom-image'+name);
	var nextLink = $('next-link'+name);
	var nextImage = $('next-image'+name);
	var previousLink = $('previous-link'+name);
	var previousImage = $('previous-image'+name);
	var rowsPerViewPort = Math.floor(viewPortPixelHeight/rowPixelHeight);
	switch(whereTo){
		case 'bottom': rowIncrement = 1*(numRows-currentRow-rowsPerViewPort); break;
		case 'previous': rowIncrement = -1; break;
		case 'top': rowIncrement = -1*(currentRow); break;
		case 'next': rowIncrement = 1; break;
		default: rowIncrement = 0;
	}
	var nextRow = currentRow + rowIncrement;
	//alert('Name: '+ name + ' InfoGroup: '+ group + ' whereTo: '+whereTo+' numRows: '+ numRows+' rowPixelHeight: '+ rowPixelHeight+' viewPortPixelHeight: '+ viewPortPixelHeight);
	//alert('Current Row: ' + currentRow + ' Row Increment: ' + rowIncrement + ' Next Row: '+ nextRow);
	if(nextRow > 0 && nextRow < numRows){
	 	topLink.show();
	 	topImage.hide();
	 	bottomLink.show();
	 	bottomImage.hide();
	 	nextLink.show();
	 	nextImage.hide();
	    previousLink.show();
	 	previousImage.hide();
	 	pixelIncrement = -rowIncrement*rowPixelHeight;
	}
	if(nextRow >= numRows-rowsPerViewPort){
	 	topLink.show();
	 	topImage.hide();
	 	bottomLink.hide();
	 	bottomImage.show();
	 	nextLink.hide();
	 	nextImage.show();
	    previousLink.show();
	 	previousImage.hide();
	 	if(nextRow == numRows-1){
	 		pixelIncrement = -rowIncrement*rowPixelHeight;
	 	}
	 	nextRow = numRows-rowsPerViewPort;
	}
	if(nextRow <= 0){
	 	topLink.hide();
	 	topImage.show();
	 	bottomLink.show();
	 	bottomImage.hide();
	 	nextLink.show();
	 	nextImage.hide();
	    previousLink.hide();
	 	previousImage.show();
	 	if(nextRow == 0){
	 		pixelIncrement = -rowIncrement*rowPixelHeight;
	 	}
	 	nextRow = 0;
	}
	//alert('tableElement.id: '+tableElement.id);
	currentRowArray[group][name] = nextRow;
	new Effect.Move(tableElement, {x: 0, y: pixelIncrement, mode: 'relative', transition: Effect.Transitions.sinoidal, queue: 'end'});
}

function resetInfoWindows(group){
	for (key in currentRowArray[group]) {
		//alert('currentRowArray['+group+']['+key+']='+currentRowArray[group][key]);
		currentRowArray[group][key] = 0;
	}

}

