
if (jQuery) (function(jQuery) {
	//jQuery.extend(jQuery.ark, { tmpl: function() { } });
	jQuery.extend(jQuery.ark.tmpl, {
		tmplLeaderboard: '\
<div class="home_lb_main_userblock coll">\
	<@ if (0 == UserID) { @><img src="http://gdgfiles.arkadium.com/static/img/avatar_off.jpg" style="margin-top:7px; margin-left:7px;" class="coll"/> <div class="coll" style="text-align:left; width:192px; margin-top:9px; margin-left: 5px;"> <a href="javascript:void(0)" style="color:#007BFF; font-weight:bold;" onclick="OpenPopupLogin();return false;">Login</a> or <a href="javascript:void(0)" onclick="OpenPopupRegister();return false;" style="color:#007BFF; font-weight:bold;">Register</a><br/>To see how you compare!</div>\
	<@ } else { @>\
		<@ if (Current && Current.Rank > 0) { @>\
			<table>\
				<tr style="height:46px;">\
					<td><a id="lb_current" href="<@= Current.UrlProfile @>&tab=avatars"><img src="<@= Current.UrlAvatar @>" style="margin-top:4px; margin-left:4px;" /></a></td>\
					<td style="width:163px; padding-left:3px; padding-top:5px;"><div class="lb_username_fix coll"><a href="<@= Current.UrlProfile @>" class="lb_colors"><@=Current.UserName@></a></div> <div class="coll" style="margin-left: 3px;"><a href="<@= Current.UrlProfile @>&tab=rating"><img src="<@=Current.UrlRating@>" alt="GDG Rating: <@=Current.GreatRating@>, User <@=Leaderboard.OnlineStatus(Current.IsOnline)@>" title="GDG Rating: <@=Current.GreatRating@>, User <@=Leaderboard.OnlineStatus(Current.IsOnline)@>" /></a></div> <div class="endCol">Rank: <@=Current.Rank@></div> </td>\
					<td style="width:60px; padding-top:6px; text-align:right;"><@=jQuery.ark.addCommas(Current.Value)@></td>\
				</tr>\
			</table>\
		<@ } else { @>\
			<@ if (Items.length > 0) { @>\
				<div class="home_lb_notlogget coll">Play to appear in Leaderboard!</div>\
			 <@ } @>\
		<@ } @>\
	<@ } @>\
</div>\
<div class="home_lb_other_userblock coll">\
	<@ if (Items.length > 0) { @>\
		<@ for ( var i = 0; i < Items.length; i++ ) { @>\
			<div class="home_lb_userblock coll">\
				<div class="coll"><a id="lb_item_<@=i@>" class="lb_item" href="<@=Items[i].UrlProfile@>&tab=avatars"><img src="<@=Items[i].UrlAvatar@>" style="margin-top:8px;" /></a></div>\
				<div class="home_lb_userinfo coll"><div class="coll lb_username_fix"><a href="<@=Items[i].UrlProfile@>"class="lb_colors"><@=Items[i].UserName@></a></div> <div class="coll" style="margin-left: 3px;"><a href="<@= Items[i].UrlProfile @>&tab=rating"><img src="<@=Items[i].UrlRating@>" alt="GDG Rating: <@=Items[i].GreatRating@>, User <@=Leaderboard.OnlineStatus(Items[i].IsOnline)@>" title="GDG Rating: <@=Items[i].GreatRating@>, User <@=Leaderboard.OnlineStatus(Items[i].IsOnline)@>" /></a></div> <div class="endCol">Rank: <@=Items[i].Rank@></div></div>\
				<div class="home_lb_usertreats coll"><@=jQuery.ark.addCommas(Items[i].Value)@></div>\
			</div>\
			<div class="home_lb_userblock_del coll" style="clear:both;"></div>\
		<@ } @>\
	<@ } else { @>\
		<div class="home_lb_notlogget coll" style="padding-top:100px;">Play to appear in Leaderboard!</div>\
	<@ } @>\
</div>',
		loginPopupDummy: 0
	});
})(jQuery);

function GetFolderNameByDividedID(id) {
    var divider = 5000;
    if(id < 0 || id == 0) id = 1;
    return (Math.floor((id / divider)) * divider);
}

