//Functions

function shots_page(shot_page,shots_perpage) {
	$.jribbble.getShotsByPlayerId('vinceangeloni', function (playerShots) {
		var html = [];
		$.each(playerShots.shots, function (i, shot) {
			html.push('<li><a href="' + shot.image_url + '" id="' + shot.id +'" title="' + shot.title + '" rel="shot_gallery"><img src="' + shot.image_teaser_url + '"><span class="desc tk-dejarip">' + shot.title + '</span></a></li>');
		});

		$('#shots').html('<ul>' + html.join('') + '</ul>');
	}, {page: shot_page, per_page: shots_perpage});
	
}

// Initialize 
$(document).ready(function() {
	shots_page(1,20);
	$("#more_link").toggle(function() {
		$("#more_link").text('Less');
		$("#shots").css('height','734px');
	}, function() {
		$("#more_link").text('More');
		$("#shots").css('height','366px');
	});
});
$(window).load(function() {
	$("#shots ul li:nth-child(4n)").addClass('last');
	$("a[rel=shot_gallery]").fancybox({
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});
});




