
var Commend=new Object();Commend.Model={"url":"","imagepath":"","maxsorce":"10","cursorce":"5","imageOff":"star_off.gif","imageOn":"star_on.gif","tagname":"","inputstar":[],"ajaxid":"","site":""};Commend.init=function(config)
{if(config.url=="")
{Commend.Model["url"]="http://mms.2008.qq.com/mms/v1/js/";}else
{Commend.Model["url"]=config.url;}
if(config.imagepath=="")
{Commend.Model["imagepath"]="images/";}else
{Commend.Model["imagepath"]=config.imagepath;}
if(config.maxsorce!="")
Commend.Model["maxsorce"]=config.maxsorce;if(config.imageOff!="")
Commend.Model["imageOff"]=config.imageOff;if(config.imageOn!="")
Commend.Model["imageOn"]=config.imageOn;if(config.site!="")
Commend.Model["site"]=config.site;if(config.vote_obj.length>0)
{for(var i=0;i<config.vote_obj.length;i++)
{if(typeof document.getElementById(config.vote_obj[i])!="undefined")
{Commend.showHTML(config.vote_obj[i],config.vote_obj[i],i);Commend.jsload(config.vote_obj[i],i);}}}}
Commend.jsload=function(qn,i)
{var scriptid=Commend.Model["url"]+qn+".js?"+Math.random();JsLoader2.load("musict_song_"+qn,scriptid,Commend.loadingDataFromJsback,qn,i);}
Commend.loadingDataFromJsback=function(qn,i)
{try{var json_data=eval('('+qn+')');if(json_data.length>0&&typeof json_data[0].number!="undefined")
{if(typeof document.getElementById(Commend.Model["inputstar"][i])!="undefined")
{document.getElementById(Commend.Model["inputstar"][i]).value=json_data[0].number;Commend.setImg(json_data[0].number,i);Commend.Model["cur"+qn]=json_data[0].number;}
if(typeof document.getElementById(qn+"_n")!="undefined")
{document.getElementById(qn+"_n").innerHTML=json_data[0].count;}
if(typeof document.getElementById(qn+"_f")!="undefined")
{if(typeof json_data[0].fcount=="undefined")
json_data[0].fcount=1;document.getElementById(qn+"_f").innerHTML="<span style=\"color:#FF0000\" >"+json_data[0].fcount+"</span>/"+Commend.Model['maxsorce']+"";}
return true;}
if(typeof document.getElementById(qn+"_n")!="undefined")
document.getElementById(qn+"_n").innerHTML="1";if(typeof document.getElementById(qn+"_f")!="undefined")
document.getElementById(qn+"_f").innerHTML="<span style=\"color:#FF0000\" >1</span>/"+Commend.Model['maxsorce'];return true;}catch(e){return false;}}
Commend.setImg=function(sorce,id)
{for(var i=1;i<=Commend.Model["maxsorce"];i++)
{image=document.getElementById('rate'+id+'_'+i);if(i>sorce)
{image.src=Commend.Model["imagepath"]+Commend.Model["imageOff"];}
else
{image.src=Commend.Model["imagepath"]+Commend.Model["imageOn"];}}}
Commend.docommend=function(tag,id,count,number,input)
{try{Commend.Model["tagname"]=tag;Commend.Model["ajaxid"]='rate'+number+'_'+input;var url_c=Commend.Model["url"]+"../voteadd.php?";var ids="id="+id+"&count="+count+"&site="+Commend.Model["site"];JsLoader3.load("musict_php",url_c+ids,Commend.comdbackto,tag,number);}catch(e){alert(e.message);}}
Commend.comdbackto=function(tag,i,count,number,status,fcount)
{if(status!="false"){if(typeof Commend.Model["tagname"]!="undefined"&&Commend.Model["tagname"]!="")
{if(!isNaN(count)&&count!=0&&!isNaN(number)&&number!=0&&!isNaN(fcount)&&fcount!=0)
{document.getElementById(Commend.Model["tagname"]).innerHTML=count;if(Commend.Model["ajaxid"]!=""&&typeof document.getElementById(Commend.Model["ajaxid"])!="undefined")
{document.getElementById(Commend.Model['ajaxid']).value=number;if(Commend.Model["tagname"].indexOf("_n")!=-1)
Commend.setImg(number,i);}
if(Commend.Model["tagname"].indexOf("_n")!=-1)
{if(typeof document.getElementById(Commend.Model["tagname"].split("_n")[0]+"_f")!="undefined")
document.getElementById(Commend.Model["tagname"].split("_n")[0]+"_f").innerHTML="<span style=\"color:#FF0000\" >"+fcount+"</span>/"+Commend.Model['maxsorce'];}}}
Commend.Model["IS_"+Commend.Model["tagname"]]="true";Commend.Model["tagname"]="";return;}
else if(status=="false"){return;}}
function showRate(name,input,numberID)
{this.name=name;this.input=input;this.length=Commend.Model["maxsorce"];this.score=Commend.Model["cursorce"];this.imageOn=Commend.Model["imageOn"];this.imageOff=Commend.Model["imageOff"];this.imagePath=Commend.Model["imagepath"];this.numberID=numberID;Commend.Model['inputstar'].push('rate'+this.numberID+'_'+this.input);}
showRate.prototype.print=function()
{var output='',image='';for(var i=1;i<=this.length;i++)
{if(i>this.score)
{image=this.imagePath+this.imageOff;}
else
{image=this.imagePath+this.imageOn;}
output+='<img id="rate'+this.numberID+'_'+i+'" onclick="return  Commend.Model[\''+this.name+'\'].setRate(event, '+i+');" onmouseover="return Commend.Model[\''+this.name+'\'].setRate(event, '+i+');" onmouseout="return  Commend.Model[\''+this.name+'\'].setRate(event, '+i+');" src="'+image+'" alt="Rate:'+i+'" title="Rate:'+i+'" style="cursor:pointer!important;cursor:hand;margin:1px;vertical-align:middle;border:none;" />';}
var OUTHTML='<span id="rate'+this.numberID+'" class="rate"></span>';OUTHTML=OUTHTML+'<input id="rate'+this.numberID+'_'+this.input+'" name="'+this.input+'" type="hidden" value="1"/>';document.getElementById(this.name).innerHTML=OUTHTML;document.getElementById('rate'+this.numberID).innerHTML=output;document.getElementById('rate'+this.numberID+'_'+this.input).value=this.score;}
showRate.prototype.setRate=function(evt,id)
{if(Commend.Model["IS_"+this.name+"_n"]=="true")
{return true;}
evt=evt?evt:(window.event?window.event:null);var onScore=1,image;switch(evt.type)
{case'mouseover':onScore=id;break;case'mouseout':if(typeof Commend.Model["cur"+this.name]!="undefined")
onScore=Commend.Model["cur"+this.name];break;case'click':Commend.docommend(this.name+"_n",this.name,id,this.numberID,this.input);break;default:return;}
if(evt.type=="click")
return;for(var i=1;i<=this.length;i++)
{image=document.getElementById('rate'+this.numberID+'_'+i);if(i>onScore)
{image.src=this.imagePath+this.imageOff;}
else
{image.src=this.imagePath+this.imageOn;}}
return true;}
Commend.showHTML=function(name,input,number)
{Commend.Model[name]=new showRate(name,input,number);Commend.Model[name].print();}/*  |xGv00|aec4cf5c45fc1fecba774e0987c83200 */