var giNoteID,gbDisUrl;

function VoteStarsOver(it)
{
	var n = Math.round((event.offsetX + 10)/20);
	if (n > 5) n = 5;
	it.style.backgroundPositionY = - n * 20;
}

function VoteStarsOut(it){
	it.style.backgroundPositionY = 0;
}

function VoteStartClick(it)
{
	var n = Math.round((event.offsetX + 10)/20);
	if (!confirm('您确定要评 ' + n + ' 星？')) return;
	if (WEBDISURL){
		wos('ArticleStar.aspx?id=' + giNoteID + '&star=' + n);

	}else{
		wos('index.aspx?ct=ArticleStar&id=' + giNoteID + '&star=' + n);
	}

}

function VoteInit(id,bd,s0,s1,s2,s3,s4,s5,ss)
{
	var i,n,p,h;
	giNoteID = id;
	gbDisUrl = bd;

	dw('<table width="400" height="28" border="1" cellspacing="4" cellpadding="0">'
		,'<form method="post" action="?ct=NoteStar">'
		,'<tr align="right" valign="bottom"><td>当前评星：</td>'
		);
	for (i=0;i<5;i++)
	{
		n = arguments[i+3];
		if (0 == s0)
			p = 0;
		else
			p = Math.round((n * 100) / s0);
		h = 20 - Math.round(p / 5);

		dw('<td class="stars100" style="background-position: 0px ',h,'px;" title="',n,' / ',s0,'">',p,'</td>');
	}
	dw('<td>您的评星：</td>'
	,'<td class="VoteStars" onmousemove="VoteStarsOver(this)" onmouseout="VoteStarsOut(this)" onclick="VoteStartClick(this)"></td>'
	,'</tr></form></table>');
}
