function $(id) { return document.getElementById(id); };

function setRating(id, level)
{
	for(var i=1; i <= 5; i++)
	{
		if(i <= level) {
			$(id+'_'+i).style.backgroundPosition = '0px -' + (13 + 13*i) + 'px';
		}
		else {
			$(id+'_'+i).style.backgroundPosition = '0px -13px';
		}
 	}
};

function unsetRating(id)
{
	var level = 0;
	
	$attValue = $(id).attributes['value'];
	if($attValue)
	{
		level = $attValue.nodeValue;
	}

 	for(var i=1; i <= 5; i++)
 	{
 		if(i <= level)
 			$(id+'_'+i).style.backgroundPosition = '0px -' + (13 + 13*i) + 'px';
 		else
 			$(id+'_'+i).style.backgroundPosition = '0px -13px';
 	}
};

function rate(id, rt)
{
	$(id).setAttribute( 'value', parseInt(rt) );
};
