$(document).ready(function() {
	
	//do not display on initial load
	$('#twitter_update_list li').css('display', 'none');

	//find first element and display
	$('#twitter_update_list li').first().css('display', 'block');
	
	//get child count and set as upper boundary (in case the number of tweets returned changes)
	var upper = $("#twitter_update_list li").size();
	
	//set position
	var position = 1;
	
	//bind next
	$('#twitter-btn-next').click(function() {
		changePosition('next');
	});

	//bind prev
	$('#twitter-btn-prev').click(function() {
		changePosition('prev');
	});
	
	function changePosition(action) {
		//hide all
		$('#twitter_update_list li').css('display', 'none');

		//identify action, set position
		if (action === 'next') {
			if (position === upper) { position = upper } else { position++ };
		}
		if (action === 'prev') {
			if (position === 1) { position = 1 } else { position-- };
		}
		//show element at position
		$('#twitter_update_list li:nth-child(' + (position) + ')').css('display', 'block');	
	}
});
