function CastleRater(id,_2,_3,_4,_5,_6,_7,_8){
if(_6==undefined||_6==null){
_6=0;
}
if(_5==undefined||_5==null){
_5=5;
}
this.ID=id;
this.MaxValue=_5;
this.Value=_6;
this.ImageOnArray=_2;
this.ImageOff=_3;
this.ImageHover=_4;
this.AutoLock=false;
this.IsEnabled=_7;
this.IsInitialized=false;
this.Images=new Array(_5);
this.Container=null;
this.ValueControl=null;
this.ValueControlID=this.ID+"_Value";
this.ringtoneId=_8;
new Image().src=this.ImageOnArray[0];
new Image().src=this.ImageOnArray[1];
new Image().src=this.ImageOnArray[2];
new Image().src=this.ImageOnArray[3];
new Image().src=this.ImageOff;
new Image().src=this.ImageHover;
};
CastleRater.Items=Array();
CastleRater.Create=function(id,_a,_b,_c,_d,_e,_f,_10){
var obj=new CastleRater(id,_a,_b,_c,_d,_e,_f,_10);
CastleRater.Items[obj.ID]=obj;
return obj;
};
CastleRater.CreateNETControl=function(id,_13,_14,_15,_16,_17,_18,_19){
var _1a=CastleRater.Create(id,_13,_14,_15,_16,_17,_18,_19);
_1a.Initialize();
return _1a;
};
CastleRater.CreateJSControl=function(id,_1c,_1d,_1e,_1f,_20,_21,_22){
var _23=CastleRater.Create(id,_1c,_1d,_1e,_1f,_20,_21,_22);
_23.Render();
return _23;
};
CastleRater.InitializeRater=function(_24){
for(i=1;i<=_24.MaxValue;i++){
var _25=_24.ID+"_img"+i;
var img=document.getElementById(_25);
_24.Images[i]=img;
}
_24.Container=document.getElementById(_24.ID);
var _27=document.getElementsByName(_24.ValueControlID);
_24.ValueControl=_27[0];
_24.IsInitialized=true;
};
CastleRater.Refresh=function(_28,_29){
var _2a=CastleRater.Items[_29];
var _2b=_2a.Value;
if(!_2a.IsEnabled){
return;
}
for(var i=1;i<=_2a.MaxValue;i++){
if(_2b>=i){
_2a.Images[i].src=_2a.ImageOnArray[i-1];
}else{
_2a.Images[i].src=_2a.ImageOff;
}
}
};
CastleRater.Hover=function(_2d,_2e){
var _2f=CastleRater.Items[_2e];
if(!_2f.IsEnabled){
return;
}
var _30=_2d.getAttribute("value");
for(var i=1;i<=_2f.MaxValue;i++){
if(_30>=i){
_2f.Images[i].src=_2f.ImageHover;
}else{
_2f.Images[i].src=_2f.ImageOff;
}
}
var _32=new Array("I hate it","I dont like it","I like it","I like it a lot","I love it");
_2f.Images[_30].title=_32[_30-1];
};
CastleRater.Click=function(_33,_34){
var _35=CastleRater.Items[_34];
if(!_35.IsEnabled){
return;
}
_35.Value=_33.getAttribute("value");
CastleRater.Refresh(_33,_34);
if(_35.AutoLock){
_35.Enable(false);
}
changeRating(_35.Value,_35.ringtoneId);
};
CastleRater.prototype.Initialize=function(){
CastleRater.InitializeRater(this);
};
CastleRater.prototype.Enable=function(_36){
this.Container.disabled=!_36;
this.IsEnabled=_36;
};
CastleRater.prototype.Visible=function(_37){
if(_37){
this.Container.style.visibility="Visible";
}else{
this.Container.style.visibility="Hidden";
}
};
CastleRater.prototype.Render=function(){
document.write("<input id="+this.ValueControlID+" type=hidden>");
document.write("<span id=\""+this.ID+"\">");
for(var i=1;i<=this.MaxValue;i++){
if(this.Value>=i){
imageName=this.ImageOnArray[i-1];
}else{
imageName=this.ImageOff;
}
var _39=document.images.length;
var _3a=" onclick=\"CastleRater.Click(this, '"+this.ID+"');\" ";
var _3b=" onmouseover=\"CastleRater.Hover(this, '"+this.ID+"');\" ";
var _3c=" onmouseout=\"CastleRater.Refresh(this, '"+this.ID+"');\" ";
var _3d=this.ID+"_img"+i;
document.write("<img class=\"hand\" align=\"absmiddle\" id=\""+_3d+"\" "+_3a+_3b+_3c+">");
this.Images[i]=document.images[_39];
this.Images[i].src=imageName;
this.Images[i].setAttribute("imageSrc",imageName);
this.Images[i].setAttribute("imageHover",this.ImageHover);
this.Images[i].setAttribute("value",i);
this.Images[i].border=0;
}
document.write("</span>");
if(this.IsInitialized==false){
this.Initialize();
}
};

