var i;
if(i == undefined) i = 0;
i++;
var star = '<div id="shade' + i + '" style="opacity: .1; float: left; margin-top: 0px; margin-left: 3px; background-color: rgb(200, 50, 50); width: 14px; height: 14px; border-bottom-left-radius: 3px 3px;border-bottom-right-radius: 3px 3px;border-top-left-radius: 3px 3px;border-top-right-radius: 3px 3px; -moz-border-radius:3px 3px 3px 3px; border: 1px solid black;"></div>';
like = '<iframe src="http://www.facebook.com/plugins/like.php?href=' + karma_url + '&layout=button_count&show_faces=false&width=80&action=like&colorscheme=light&ref=likeButton" scrolling="no" frameborder="0" allowtransparency="true" style="border:none; overflow:hidden; width:80px; height:33px; margin-top: -2px; margin-left: 2px; margin-right: -25px;"></iframe>';
out = '<div class="karma"><span class="karma-points" id="karma' + i + '"></span>' + star + '<div class="karma-inner"><div class="karma-text">karma points</div></div>' + like + '</div>';
document.write(out);

getPoints(i);
function getPoints(i) {
 $('#karma' + i).html('...').load('/karma.php?u=' + karma_url, function() {
  karma = Math.log($(this).html() / 15) * 120;
  rgb = hsvToRgb(karma, 90, 90);
  rgbb = hsvToRgb(karma, 60, 60);
  $('#shade' + i).css('background-color', 'rgb(' + rgb[0] + ', ' + rgb[1] + ', ' + rgb[2] + ')');
  $('#shade' + i).css('border-color', 'rgb(' + rgbb[0] + ', ' + rgbb[1] + ', ' + rgbb[2] + ')');
  $('#shade' + i).delay(i*100).css('opacity', 1).hide().fadeIn('slow');
 });
}

