$(document).ready(function(){
	// make sure we have a good link index
	if (typeof(bottom_link) == 'undefined' || parseInt(bottom_link) != bottom_link) bottom_link = 0;
	if (bottom_link > $('#bottom-links .link-list > a').length - 1) bottom_link = $('#bottom-links .link-list > a').length - 1;

	// add class selected to current page link
	$('#bottom-links .link-list > a').eq(bottom_link).addClass('selected');

	// hide or change href for previous
	if (bottom_link == 0){
		$('#bottom-links .link-prev > a').css('display', 'none');
	} else {
		$('#bottom-links .link-prev > a').attr('href', $('#bottom-links .link-list > a').eq(bottom_link - 1).attr('href'));
	}

	// hide or change href for next
	if (bottom_link == $('#bottom-links .link-list > a').length - 1){
		$('#bottom-links .link-next > a').css('display', 'none');
	} else {
		$('#bottom-links .link-next > a').attr('href', $('#bottom-links .link-list > a').eq(bottom_link + 1).attr('href'));
	}
	
	$('#bottom-links .link-next').hover(function(){
		$('img', this).attr('src', '/bc/assets/images/arrow-link-right.png');
	  },function(){
	  	$('img', this).attr('src', '/bc/assets/images/arrow-right-black.png');
	});
	$('#bottom-links .link-prev').hover(function(){
		$('img', this).attr('src', '/bc/assets/images/arrow-link-left.png');
	  },function(){
	  	$('img', this).attr('src', '/bc/assets/images/arrow-left-black.png');
	});
});
