function starsClass(_1,w,h,_4){
this.stars_num=_1;
this.star_w=w;
this.star_h=h;
this.total_w=this.stars_num*this.star_w;
this.images=_4;
this.agent=Math.max(navigator.userAgent.toLowerCase().indexOf("msie"),0)?"ie":"other";
this.reset=function(v){
this.current_div_id="";
this.current_val=-1;
this.painted_val=-1;
};
this.reset();
this.preload_images=function(){
var _6=new Array();
for(i=0;i<this.images.length;i++){
_6[i]=new Image();
_6[i].src=this.images[i];
}
};
this.preload_images();
this.absPos=function(o){
var r={x:o.offsetLeft,y:o.offsetTop};
if(o.offsetParent){
var v=this.absPos(o.offsetParent);
r.x+=v.x;
r.y+=v.y;
}
return (r);
};
this.cursor_pos=function(e){
e=e||window.event;
var _b={x:0,y:0};
if(e.pageX||e.pageY){
_b.x=e.pageX;
_b.y=e.pageY;
}else{
var de=document.documentElement;
var b=document.body;
_b.x=e.clientX+(de.scrollLeft||b.scrollLeft)-(de.clientLeft||0);
_b.y=e.clientY+(de.scrollTop||b.scrollTop)-(de.clientTop||0);
}
return _b;
};
this.update=function(){
var _e=this.current_div();
if(!_e||this.current_val<0){
return;
}
_e.title=this.current_val+"";
};
this.set_current=function(_f){
if(this.current_div_id==_f.id){
return;
}
if(parseFloat(_f.title)<-1){
return;
}
this.restore();
this.reset();
this.current_div_id=_f.id;
};
this.refresh=function(e){
var _11=this.current_div();
if(!_11){
return;
}
var p=this.absPos(_11);
cursor_xy=this.cursor_pos(e);
var eX=cursor_xy.x-p.x;
var eY=cursor_xy.y-p.y;
if(eX<1||eX>this.total_w||eY<0||eY>this.star_h){
this.restore();
}else{
v=eX/this.total_w;
stars_gold=Math.round(this.stars_num*v);
stars_gold_grey=v-(1/this.stars_num)*stars_gold>1/(this.stars_num*4)?1:0;
this.current_val=stars_gold+stars_gold_grey*0.5;
this.paint(this.current_val);
}
};
this.restore=function(){
var _15=this.current_div();
if(!_15){
return;
}
v=parseFloat(_15.title);
this.paint(v);
this.reset();
};
this.paint=function(v){
var _17=this.current_div();
if(v>this.stars_num){
v=this.stars_num;
}
if(v<0){
v=0;
}
if(!_17||v==this.painted_val){
return;
}
_17.innerHTML=this.build_html(v);
this.painted_val=v;
};
this.build_html=function(v){
if(v>this.stars_num){
v=this.stars_num;
}
if(v<0){
v=0;
}
stars_gold=Math.floor(v);
stars_gold_grey=v-stars_gold>0.4?1:0;
stars_grey=this.stars_num-stars_gold-stars_gold_grey;
html="";
alt=stars_gold+(stars_gold_grey?".5":"")+" out of "+this.stars_num;
for(i=0;i<stars_gold;i++){
html+="<img src=\""+this.images[0]+"\" width=\""+this.star_w+"\" height=\""+this.star_h+"\" border=\"0\" alt=\""+alt+"\">";
}
for(i=0;i<stars_gold_grey;i++){
html+="<img src=\""+this.images[1]+"\" width=\""+this.star_w+"\" height=\""+this.star_h+"\" border=\"0\" alt=\""+alt+"\">";
}
for(i=0;i<stars_grey;i++){
html+="<img src=\""+this.images[2]+"\" width=\""+this.star_w+"\" height=\""+this.star_h+"\" border=\"0\" alt=\""+alt+"\">";
}
return "<nobr>"+html+"</nobr>";
};
this.init=function(){
var _19=document.getElementsByTagName("DIV");
for(var i=0;i<_19.length;i++){
if(_19[i]&&_19[i].id&&_19[i].id.indexOf("star_")==0){
this.init_div(_19[i]);
}
}
};
this.init_div=function(div){
if(!div){
return;
}
this.set_current(div);
this.restore();
};
this.current_div=function(v){
if(this.current_div_id==""){
return null;
}
div=document.getElementById(this.current_div_id);
if(!div){
this.reset();
}
return div;
};
}

