var RATING ="0";
var stars = new Array("s1","s2","s3","s4","s5");
window.onload = prepareLinks;
function prepareLinks() {
	var slinks = document.getElementsByTagName("a");
	for (var i=0; i< slinks.length; i++) {
		if (slinks[i].getAttribute("name").indexOf("star") != -1 ){
			var current_id = slinks[i].getAttribute("id");
			slinks[i].onmouseenter = 
			function() {
				RATING = this.getAttribute("id"); 
				deselectStar(stars);
			}
			slinks[i].onmouseleave = 
			function() {
				RATING = this.getAttribute("id"); 
				highlightStar( this.getAttribute("id") );
			}
			slinks[i].onclick = 
			function() {
				RATING = this.getAttribute("id"); 
				highlightStar( this.getAttribute("id") );
			}
		}
	}
}
function highlightStar(id){
	var instance = document.getElementById(id);
	instance.style.backgroundImage="url('/thefacts/imagerepository/star_small.gif')";	
	instance.style.backgroundPosition="50px 100px";
}
function deselectStar(stars){
	for ( var i = 0; i < stars.length; i++ ){
		var instance = document.getElementById(stars[i]);
		instance.style.backgroundImage="";	
		instance.style.backgroundPosition="top left";
	}
}
