var popcap_score_mode = "";

function MakeScoreDisplay()
{
	if (popcap_score_report)
	{
		var score_tag = "";

		score_tag += "<DIV id='popcap_score_mode'>Mode:</DIV>";
		score_tag += "<DIV id='popcap_score_level'>Level:</DIV>";
		score_tag += "<DIV id='popcap_score_display'>Score:</DIV>";

		document.write(score_tag);
	}
}

function PopcapScoreSetMode(val)
{
	document.getElementById("popcap_score_mode").innerHTML = 'Mode: ' + val;
}

function PopcapScoreSetScore(val)
{
		document.getElementById("popcap_score_display").innerHTML = 'Score: ' + val;
}

function PopcapScoreSetLevel(val)
{
		document.getElementById("popcap_score_level").innerHTML = 'Level: ' + val;
}


function PopcapScoreReceiveNotification(method,param)
{
	if (method=="pc_gamestart")
	{
		popcap_score_mode = param;
		if (popcap_score_mode=="")
			popcap_score_mode = "Default";

		PopcapScoreSetMode(popcap_score_mode);
		PopcapScoreSetLevel("1");
		PopcapScoreSetScore("0");
	}
	else if (method=="pc_scorebroadcast")
	{
		PopcapScoreSetScore(param);
	}
	else if (method=="pc_gameover")
	{
		PopcapScoreSetMode(popcap_score_mode + " (gameover)");
	}	
	else if (method=="pc_gamebreak")
	{
		PopcapDebug('ScoreGameBreak: ' + method + ' ' + param);
		var params = param.split(",");
		var level = parseInt(params[0]);
		if (params.length<2 || params[1]!='gameover')
			level++;

		PopcapScoreSetLevel(level);		
	}	
}

MakeScoreDisplay();
