$.jribbble.getShotsByPlayerId('xtkoeller', function (playerShots) {
    var html = [];

    $.each(playerShots.shots, function (i, shot) {
        //html.push('<li><h4>' + shot.title + '</h4>');
        html.push('<li><img class="drbl" src="' + shot.image_url + '"/></li>');
    });

    $('#dribbbleshots ul').html(html.join(''));
}, {page: 1, per_page: 7});

   
$(function () {
	$('.planet').each(function() {
		var trigger = $('.trig', this);
		var bubble = $('.bubble', this);
		var delay = 300;
		var delayTimer = null;
		var tiem = 200;
		var beingShown = false;
		var shown = false;
		
		$([trigger.get(0), bubble.get(0)]).mouseover(function() {
    		if (delayTimer) clearTimeout(delayTimer);
			if (beingShown || shown) {
			return;
			} else {
				beingShown = true;
				bubble.css({
					display: 'block',
				}).animate({
					opacity: '1'
				}, tiem, 'linear', function() {
					beingShown = false;
					shown = true;
				});
			}
		}).mouseout(function() {
    		if (delayTimer) clearTimeout(delayTimer);
    		
    		delayTimer = setTimeout(function() {
    			delayTimer = null;
				bubble.animate({
					opacity: '0'
				}, tiem, 'linear', function() {
					shown = false;
					bubble.css('display', 'none');
				});
    		}, delay);
		});
	});
});

