/* User Opinion graphs */


function movie_graph(data,width,height,margin) {

//colors=new Array("FF0000","FF7200","FFC000","F6FF00","96FF00","00FF12","1CAA26");
colors=new Array("FF0000","FF0000","F6FF00","F6FF00","F6FF00","1CAA26","1CAA26");
max=0;
sum=0;


for (i=0;i<data.length;i++) {
if (data[i]>max) max=data[i];
sum=sum+data[i];
}
avg=sum/data.length;

for (i=0;i<data.length;i++) {
if (data[i]>0) w=Math.floor(data[i]/(sum/width));
else w=1;
document.write("<img src=\"http://static.nightparty2.ru/i/trans.gif\" style=\"width:"+w+"px;height:"+height+"px;background-color:#"+colors[i]+";margin:"+margin+" 0 0 0;\" onmouseover=\"stt('Соотношение отзывов. Чем больше красного - тем хуже фильм. Чем больше зеленого - тем лучше');\" onmouseout=\"htm();\">");
//document.write("</td>");
}
document.write("<br><div style=\"color:#777777;font-size:9px;margin-bottom:"+margin+"px\">рейтинг фильма<br>по "+sum+" отзывам<br>наведи мышкой</div>");

/*
//document.write("<table cellpadding=0 cellspacing=1 height="+(height+2)+">");
document.write("<img src=\"http://static.nightparty2.ru/i/bad.gif\" width=8 height=9 style=\"margin-right:10px\">");
for (i=0;i<data.length;i++) {
//document.write("<td valign=bottom>");
if (data[i]>0) h=Math.floor(height*(data[i]/max));
else h=1;


document.write("<img src=\"http://static.nightparty2.ru/i/trans.gif\" style=\"height:"+h+"px;background-color:#"+colors[i]+";margin-right:1px\" width="+width+">");
//document.write("</td>");
}

document.write("<img src=\"http://static.nightparty2.ru/i/good.gif\" width=8 height=9 style=\"margin-left:9px\">");
*/
//document.write("</table>");

}