﻿
window.onload = function(){

    var div ;

    var starCount = 5;

    for(var i=1; i < starCount + 1; i++)
    {
        div =  $('star' + i);

        RuanYu.Utility.setAlpha(div, 1);

        div.onmouseover = function()
        {
	        set_star_light(Number(this.id.replace('star','')));
        }

        div.onmouseout = function()
        {
	        set_star_light(Number(this.id.replace('star','')));
        }

        div.onclick = function()
        {
	        //alert(':' + this.id.replace('star','') + '.');
        }
    }

}

function set_star_light(value)
{
	var starCount = 5;

	var div;

	for(var i=1; i < starCount + 1; i++)
	{
		div = $('star' + i);

		if(i == value)
		{
			RuanYu.Utility.setAlpha(div,0.5);
			div.src = '/images/star_color.gif';
		}
		else if(i < value + 1)
		{
			RuanYu.Utility.setAlpha(div,1);
			div.src = '/images/star_color.gif';
		}
		else
		{
			RuanYu.Utility.setAlpha(div,1);
			div.src = '/images/star_white.gif';
		}
	}
}
