//preload image which will be seen on mouseover, else there will be a delay
var oImage = new Image()
oImage.src = '/community/images/star1.png'

//called when a user mouses over a star, to highlight all the stars up to that point
function shine(oImage) {
	var iStar = oImage.id.substr(0, 1) //first char of ID is the star number
	var sImageID = oImage.id.substr(1, 20) //rest of ID is shared with that group of 5
	document.getElementById('1' + sImageID).src = '/community/images/star1.png'
	if (iStar > 1) document.getElementById('2' + sImageID).src = '/community/images/star1.png'
	if (iStar > 2) document.getElementById('3' + sImageID).src = '/community/images/star1.png'
	if (iStar > 3) document.getElementById('4' + sImageID).src = '/community/images/star1.png'
	if (iStar > 4) document.getElementById('5' + sImageID).src = '/community/images/star1.png'
}

//called when user mouses off a star, to blank all 5 stars off
function unshine(oImage) {
	var sImageID = oImage.id.substr(1, 20)
	document.getElementById('1' + sImageID).src = '/community/images/star0.png'
	document.getElementById('2' + sImageID).src = '/community/images/star0.png'
	document.getElementById('3' + sImageID).src = '/community/images/star0.png'
	document.getElementById('4' + sImageID).src = '/community/images/star0.png'
	document.getElementById('5' + sImageID).src = '/community/images/star0.png'
}

//called when user clicks on a star to vote
function vote(iItemType, iItemID, iStar) {
	var oDiv = document.getElementById('div_rating_' + iItemType + '_' + iItemID)
	oDiv.innerHTML = '<iframe name="rating" frameborder="0" scrolling="no" style="width:90%;height:27px" src="/community/vote/save_rating.asp?type=' + iItemType + '&id=' + iItemID + '&star=' + iStar + '"></iframe>'
}

