/* Author: Jon Rundle
*/

$(window).load(function(){
	$('.dribbble-shots li').each(function() {
		$(this).animate({'opacity': 1});
	});
});

$(document).ready(function(){
	$('section').delay(500).animate({top: '50%'}, {duration: 800, easing: 'easeOutQuart'});
	$('body').addClass($.browser);
	var windowHeight = $(window).height();
	var windowWidth = $(window).width();
	
	$('#container').css('height', windowHeight);
	$('#container').css('width', windowWidth);
	$('#dribbbleShots ul').css('width', windowWidth + 500);
	
	$(window).resize(function() {
		var windowHeight = $(window).height();
		var windowWidth = $(window).width();
		$('#container').css('height', windowHeight);
		$('#container').css('width', windowWidth);
		$('#dribbbleShots ul').css('width', windowWidth + 500);
	});
	
	$('.ribbon').click(function() {
		$('section').animate({top: '-30%'}, {duration: 800, easing: 'easeOutQuart'});	
		$('.topRibbon').animate({top: '-5px'}, {duration: 800, easing: 'easeOutQuart'});	
		$('#dribbbleShots').addClass('slidUp');
	});
	
	$('.topRibbon').click(function() {
		$('section').animate({top: '50%'}, {duration: 800, easing: 'easeOutQuart'});
		$(this).animate({top: '-40px'}, {duration: 800, easing: 'easeOutQuart'});	
		$('#dribbbleShots').removeClass('slidUp');
	});
});

$.jribbble.getShotsByPlayerId('jonrundle', function (playerShots) {
	var html = [];
	$.each(playerShots.shots, function (i, shot) {
		//html.push('<li><h3>' + shot.title + '</h3>');
		//html.push('<h4>by ' + shot.player.name + '</h4><a href="' + shot.url + '">');
		//shot.likes_count
		//shot.views_count
		html.push('<li><a href="' + shot.url + '" target="_blank"><img src="' + shot.image_url + '" ');
		html.push('alt="' + shot.title + '"></a></li>');
	});
		
	$('.dribbble-shots').html(html.join(''));
}, {page: 1, per_page: 20});
























