var rating_default = 0;
var voted = 0;
function setRateText(id)
{
	if (voted == 0) 
	{
		var ratingText = Array();
		ratingText[0]='&nbsp;';
		ratingText[1]='Lame';
		ratingText[2]='Bad';
		ratingText[3]='Alright';
		ratingText[4]='Good';
		ratingText[5]='Awesome';
		var ratingTextDiv = document.getElementById("ratingText");
		ratingTextDiv.innerHTML = ratingText[id];
		var star="star"+(id*10); 
		document.getElementById(star).title = ratingText[id];
		document.getElementById("rsdiv").style.width="0%";
	}
}
function setRateText0(w)
{
	if (voted == 0) 
	{
		document.getElementById("ratingText").innerHTML='&nbsp;';
		document.getElementById("rsdiv").style.width=w+"%";
	}
}
function rate(id, vote) 
{
	if (voted == 0) 
	{
		rating_default = vote;
		var percentage = (vote*20); //20% corresponds to 1 star
		document.getElementById("rs").className ="rating_stars";
		document.getElementById("rsdiv").style.width=percentage+"%";

		var outURL = "http://www.lolsome.com/vote.php?id="+id+"&vote="+vote;
		window.hiddenframe.location.href = outURL;
		voted = 1;

		var ratingTextDiv = document.getElementById("ratingText");
		ratingTextDiv.innerHTML = 'Thanks for voting!';
		
		for (var i = 10; i<=50; i+=10) 
		{
			document.getElementById("star"+i).className = "nostars";
		}

	}
}

