var ratings = new Array;

function votio_handleHttpResponse()
{
	if(votio_http.readyState == 4)
	{
		var s = votio_http.responseText;
		var res = s.split(",");
		var id = res[0];
		var index = res[1];
		var message = res[2];
		var textmsg = document.createTextNode(message);
		var votediv = document.getElementById('votediv_' + id);
		votediv.removeChild(votediv.firstChild);
		votediv.appendChild(textmsg);
		for(z=1; z<=5; z++)
		{
			i = document.getElementById("star_" + id + "_" + z);
			if (z <= index)
				usei = "_img/star1.gif";
			else
				usei = "_img/star0.gif";
			i.setAttribute("src", usei);
			i.setAttribute("onmouseover", null);
			i.setAttribute("onmouseout", null);
		}
	}
}

function votio_vote(id, index)
{
	window.location.href="vote.php?id=" + id + "&vote=" + index;
}

function votio_hover(id, index, rating)
{
	var i, z;
	ratings[id] = rating;
	for (z=1; z<=5; z++) {
		i = document.getElementById(id + "_" + z);
		if (z <= index) {
			usei = "_img/starvs.gif";
		} else {
			usei = "_img/starv.gif";
		}
		i.setAttribute("src", usei);
	}
}
function votio_unhover(id, index)
{
	var i;

	for (z=1; z<=5; z++) {
		i = document.getElementById(id + "_" + z);
		im = (ratings[id] >= z) ? "star1.gif" : "star0.gif";
		usei = "_img/" + im;
		i.setAttribute("src", usei);
	}
}


