﻿
LeaderboardServices.GetPlayerHighScores(null, "Emoticons", null, null, EndGetEmoticonsHighScores);

function EndGetEmoticonsHighScores(response)
{
	if(!HandleCommonResults(response))
	{
		if(IsSuccessResult(response))
		{
		    var emoticonsHighScoresList = document.getElementById("emoticonsHighScoresList");
		    if (response.HighScores.length > 0)
		    {
		        emoticonsHighScoresList.innerHTML = '<hr /><span class="boldInfo">My High Scores</span><br />';
		        for (var i = 0; i < response.HighScores.length; i++)
		        {
		            var highScore = response.HighScores[i];

		            var listItem = document.createElement("li");
		            emoticonsHighScoresList.appendChild(listItem);

		            var scoreLink = document.createElement("a");
		            SetClass(scoreLink, "emoticonsListLink");
		            scoreLink.innerHTML = Math.round(highScore.RecordValue) + " " + highScore.LeaderboardDescription;
		            scoreLink.href = highScore.LeaderboardUrl + "&name=" + highScore.PlayerName;
		            //scoreLink.href = "emoticonsHome.htm?leaderboard=" + highScore.LeaderboardId + "&name=" + highScore.PlayerName;
		            listItem.appendChild(scoreLink);
		        }
		    } else
		    {
		        //emoticonsHighScoresList.innerHTML = '<hr /><span class="boldInfo">You do not have any high scores yet...</span>';
		        emoticonsHighScoresList.innerHTML = '<hr /><span class="boldInfo">This game is coming soon...</span>';
		    }
		}
		else
		{
			UnknownResult(response);
		}
	}
}
