﻿function GradeVote() {
        this.VoteMaxStar=1;
        this.VoteCounter=1;
        this.VoteContent=new Array();
        this.GradeVoteImage1="";
        this.GradeVoteImage2="";
        this.Type=0;
        this.AltHtmlId="";
        this.ImgArea="";

        this.AddContent=function (sNA) {
                this.VoteContent["_"+this.VoteCounter]=sNA;
                this.VoteCounter++;
        }
        /*创建评分星星*/
        this.CreateVote=function (MaxStar,DefaultStar,AltId,ImgA,VoiteType,objct)
        {
                var i=1,j=1;
                var VoteImgHTML="";
                this.VoteMaxStar=MaxStar;
                this.AltHtmlId=AltId;
                this.ImgArea=ImgA;
                this.Type=VoiteType;
                for (i=1;i<=MaxStar;i++) {
                        VoteImgHTML+="<img id=\"_"+ImgA+""+i+"\" src=\""+(j<=DefaultStar ? this.GradeVoteImage1 : this.GradeVoteImage2)+"\" border=\"0\" onMouseOver=\""+objct+".HitVote('"+i+"','"+ImgA+"');\" onClick=\""+objct+".VoteSubmit('"+i+"');\">";
                        j++;
                }
                if (document.getElementById(this.AltHtmlId)!=null) {
                        document.getElementById(this.AltHtmlId).innerHTML=VoteImgHTML;
                }
                else {
                        alert("Object not found!!");
                }
        }
        /*评分等级内容*/
        this.VoteScoreContent=function (sID) {
                var VoteContent=this.VoteContent["_"+sID];
                if (VoteContent=="undefined" || VoteContent==null) VoteContent="Not defined!!";
                return VoteContent;
        }
        /*鼠标放到星星上*/
        this.HitVote=function (sID,img) {
                var i=1;
                for (i=1;i<=sID;i++) {
                        document.getElementById("_"+img+""+i).src=this.GradeVoteImage1;
                }
                document.getElementById(this.ImgArea).innerHTML=this.VoteScoreContent(sID);
                sID++;
                for (i=sID;i<=this.VoteMaxStar;i++) {
                        document.getElementById("_"+img+""+i).src=this.GradeVoteImage2;
                }
        }
        /*提交评分*/
        this.VoteSubmit=function (sID) {
        //alert("您打了"+sID+"分！"+"类型为"+this.Type);                
        //setScores(sID,this.Type);  
		Ext.get(this.AltHtmlId+"a").dom.innerHTML=sID;
        }
}



  //------------Ext.onReady为页面初始化执行函数------------------
     
//      Ext.onReady(function(){     
//      var button = Ext.get('kk');
//          button.on('click', function(){
//         
//             setScores(333,2);  
//             
//                  
//                  
//          //附加事件end 
//          });     
//     });



       
     //------------异步处理请求Flash处理的函数---------------------
            var setScores=function(Atype,uid,p1,p2,p3){
            var infos;//返回处理结果字符串
            Ext.Ajax.request({
                url: "Vote.ashx?Atype="+Atype+"&Uid="+uid+"&parm1="+p1+"&parm2="+p2+"&parm3="+p3, //请求地址
                success: function(request)
                {
                    infos = request.responseText; //服务器端文本数据
                    //win.hide();//不用win.close(),否则不再打开了
                    alert(infos);
                                 
                },
                failure: function() 
                {
                    alert("抱歉！数据获取失败！请稍后再试！");
                }
            });
        };
      //-----------------------------------------------
