/**
 * jQuery Plugin "jribbble" 0.11.0
 * Author: Tyler Gaw - http://tylergaw.com
 * LastChanged: 09/06/2010
 * 
 * A jQuery plugin to fetch data from the Dribbble API - http://dribbble.com/api
 *
 */
(function(a){a.fn.jribbble=function(){this.makeRequest=function(b,c,d){b=b.replace("//","/");a.ajax({data:d,dataType:"jsonp",success:function(e){a.isFunction(c)&&c(e)},type:"GET",url:a.jribbble.baseUrl+b})};return this};a.jribbble={};a.jribbble.baseUrl="http://api.dribbble.com";a.jribbble.paths={shots:"/shots/",rebounds:"/rebounds/",following:"/following/",players:"/players/",followers:"/followers/",draftees:"/draftees/",comments:"/comments/"};a.jribbble.getShotById=function(b,c){var d=a.jribbble.paths.shots+
b;a.fn.jribbble().makeRequest(d,c)};a.jribbble.getReboundsOfShot=function(b,c,d){b=a.jribbble.paths.shots+b+a.jribbble.paths.rebounds;a.fn.jribbble().makeRequest(b,c,d)};a.jribbble.getShotsByList=function(b,c,d){b=a.jribbble.paths.shots+b;a.fn.jribbble().makeRequest(b,c,d)};a.jribbble.getShotsByPlayerId=function(b,c,d){b=a.jribbble.paths.players+b+a.jribbble.paths.shots;a.fn.jribbble().makeRequest(b,c,d)};a.jribbble.getPlayerById=function(b,c){var d=a.jribbble.paths.players+b;a.fn.jribbble().makeRequest(d,c)};a.jribbble.getCommentsOfShot=function(b,c,d){b=a.jribbble.paths.shots+b+a.jribbble.paths.comments;a.fn.jribbble().makeRequest(b,c,d)}})(jQuery);

$(document).ready(
	function ()
	{		
		
		
		// API Ref: http://api.dribbble/players/:id/shots
		$.jribbble.getShotsByPlayerId('mattdempseycom',
			function (playerShots)
			{
				var html = [];
				$.each(playerShots.shots, function (i, shot)
				{
					html.push('<a href="' + shot.url + '" class="dribbble-image">');
					html.push('<img src="' + shot.image_url + '" ');
					html.push('alt="' + shot.title + '"></a>');
				});
				
				$('#dribbble-latest').html(html.join(''));
			},
			{page: 1, per_page: 2}
		);
		
	}
);


function goToByScroll(id){
     			$('html,body').animate({scrollTop: $("#"+id).offset().top},'slow');
}
