function turnPage(distance, list, action) {
	if(!list.page)
		list.page = 1;
	if(list.page + distance > 0) {
		list.page = list.page + distance;
		showPage(list.page, list, action);
	}
}

function showPage(page, list, action) {
	var params = new Array();
	params['page'] = page;
	if(typeof(wallId) != 'undefined')
		params['wallId'] = wallId;
	else if(typeof(userId) != 'undefined') 
		params['userId'] = userId;
	var opt = {
		method: 'post',
		parameters: $H(params).toQueryString(),
		asynchronous: true
	}
	new Ajax.Updater(list, action, opt);
}


function showNextRecent() { turnPage(1, $('recentList'), ajaxURL('/listRecentWalls.action')); }
function showPreviousRecent() { turnPage(-1, $('recentList'), ajaxURL('/listRecentWalls.action')); }
function showNextFriends(event) { turnPage(1, $('friendList'), ajaxURL('/listFriendsWalls.action')); }
function showPreviousFriends(event) { turnPage(-1, $('friendList'), ajaxURL('/listFriendsWalls.action')); }
