function vote(amt,aid)
{
	xmlhttp = getHttpReqObj();
	xmlhttp.open("GET","/sys_voting.php?vote="+amt+"&item_id="+aid, true);
	xmlhttp.send();
	
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			document.getElementById("ratingmsg").innerHTML=xmlhttp.responseText;
			//document.getElementById("starrating").className = "rating " + amt + "star";

			if(amt == 1)
			{
				document.getElementById("starrating").style.backgroundPosition = '0 -16px';
			}
			else if(amt == 2)
			{
				document.getElementById("starrating").style.backgroundPosition = '0 -32px';
			}
			else if(amt == 3)
			{
				document.getElementById("starrating").style.backgroundPosition = '0 -48px';
			}
			else if(amt == 4)
			{
				document.getElementById("starrating").style.backgroundPosition = '0 -64px';
			}
			else if(amt == 5)
			{
				document.getElementById("starrating").style.backgroundPosition = '0 -80px';
			}
		}
	}
}

function setRatingVal(val)
{
	Val = parseInt(val);
	for(var i=0; i<Val;i++)
	{
		var li = document.getElementById("rate"+i);
		li.innerHTML = '&clubs;';
	}
}

function getHttpReqObj()
{
	if (window.XMLHttpRequest)
	{// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}
	else
	{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return xmlhttp;
}
