function starSet(num)
{
	for (i = 1; i <= 5; i++)
	{
		image = document.getElementById('star'+i);
		if (i <= num)
			image.src = 'graphics/star.png';
		else
			image.src = 'graphics/star-outline.png';
	}

}

function resetStars(num)
{
	if (typeof starDefault == 'undefined')
		starSet(num);
	else
		starSet(starDefault);
}

function setPageRating(PageID, PageRating)
{
	var xmlhttp;
	if (window.XMLHttpRequest)
	{// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}
	else
	{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange = function()
	{
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			starDefault = xmlhttp.responseText;
			starSet(xmlhttp.responseText);
		}
	}

	xmlhttp.open("GET","ajax.php?action=setPageRating&PageID="+PageID+"&PageRating="+PageRating,true);
	xmlhttp.send();

}


