function StarHover(id,count){
	for(var i=1;i<=5;i++){
		if(i<=count){
		document.getElementById('imgStar' + id + i).src = "/images/starred.gif";
		}
		else{
		document.getElementById('imgStar' + id + i).src = "/images/stargrey.gif";
		}
	}
}

var clicked = false;

function ClearStars(id){
		for(var i=1;i<=5;i++){
			document.getElementById('imgStar' + id + i).src = document.getElementById('imgStar' + id + i).getAttribute("cached");
		}
}

function SelectStar(id,count, product){

	new Ajax.Request('/send_rating.asp?product_id=' + product + '&r=' + count, { method:'get',requestHeaders: {Accept: 'application/json'},onSuccess: 
	function(transport){
		var json = eval('(' + transport.responseText + ')');
		document.getElementById('spnRat' + id).innerHTML = json.count + " ratings - Click on stars to rate this product";
		QuickSelectStar(id,json.rating);
		
		if(json.success == true){
		
			document.getElementById('img' + id).style.display='inline';
		}
	} 
	});
	for(var i=1;i<=5;i++){
		if(i<=count){
		document.getElementById('imgStar' + id + i).src = "/images/starred.gif";
		}
		else{
		document.getElementById('imgStar' + id + i).src = "/images/stargrey.gif";
		}
		document.getElementById('imgStar' + id + i).setAttribute("cached",document.getElementById('imgStar' + id + i).getAttribute("src"));
	}
	
}

function QuickSelectStar(id, count){
	for(var i=1;i<=5;i++){
		if(i<=count){
		document.getElementById('imgStar' + id + i).src = "/images/star.gif";
		}
		else{
		document.getElementById('imgStar' + id + i).src = "/images/stargrey.gif";
		}
		document.getElementById('imgStar' + id + i).setAttribute("cached",document.getElementById('imgStar' + id + i).getAttribute("src"));
	}
}
