/*********************************************************************************

	Purpose:
		Set star rating to show correct images when user clicks the star rater
		
		This also sets a hidden field that will pass the rating when the form is
		submitted.
		
	Parameters:
		The anchor tag for the link clicked must be passed to this function
		
*********************************************************************************/
function rvSetRating(starA) {
	// need to grab the string that is used as a prefix for all element IDs related to this particular rater
	// ID of rater UL tag contains that string, so grab it
	var raterID = starA.parentNode.parentNode.id;
	
	// everything below this will fail without this ID, so bail if we don't have it
	if (typeof raterID != 'string') return;

	// grab the first <li> tag in the rater, which is for the current-rating
	var currentRatingLI = getFirstChildElement(document.getElementById(raterID));
	
	// set hidden field equal to rating clicked
	var ratingNumber 	= starA.innerHTML;
	var ratingInt		= parseInt(ratingNumber);
	var ratingPercent	= ratingInt * 20;			// convert rating to a percentage
	
	document.getElementById(raterID + '_rating').value = ratingNumber;
	
	// make stars show rating chosen...they don't do this automatically :(
	currentRatingLI.style.backgroundPosition	= 'left bottom';
	currentRatingLI.style.width					= ratingPercent.toString() + '%';	
	
	// show "your rating: blah stars" message
	document.getElementById(raterID + '_your_rating_number').innerHTML = ratingNumber;
	document.getElementById(raterID + '_rv_your_rating_info').style.display = 'inline';
}