// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function eventScoreSubmitted(posted, gemsEarned, testFlag, score, vars) {
	
	if (posted) {
		
		var gem = "<div class='gem'>" + "<img src='/images/gem_pink.png' alt='' width='55' height='47' />" + "</div>";
		
		var prefix = ""
		if (testFlag == "true") {
			prefix = "*** TEST MODE - User would have earned ";
		} else {
			prefix = "Congratulations -  you earned "
		}
		
		var msg = gem + prefix + String(gemsEarned) + " " + "gem".pluralize(parseInt(gemsEarned)) + "!"
		
		if (testFlag == "true") {
			msg += "<br />" + "score: " + score;
		}
		
		$j.jGrowl(msg, { theme:'gemsEarned', life:4400 });
		


		// update gem total in nav area	
		if (testFlag == "false") {
			var numGems = parseFloat(cleanNumber($j("#cloud .points").text())) + parseFloat(gemsEarned);							
			$j("#cloud .points").html(numGems).format({format:"#,###", locale:"us"}); 													
		}	
								
	} else {
		//alert("an error occurred: " + vars);
	}
	   
}







