<?xml version="1.0"?>
<labeltemplate>
  <label>
     <![CDATA[
     <script>
    var num = 1;
    var type=0;
    jQuery(document).ready(function(){
        initialComment();
         $("#toploadcomment").click(function () {
                oncommentlist();
            });
          
    });
			 
    function initialComment(){
			 
        jQuery.getScript('{$GetSiteUrl}plus/course/CosComment.ashx?action=getcommentinfo&courserid={KS:Field:CourseID}&orderType={$OrderType}',function(){
            var goodNum=parseInt(comment.goodNum);
            var averageNum=parseInt(comment.averageNum);
            var badNum=parseInt(comment.badNum);
            var totalNum=goodNum+averageNum+badNum;
            $(".totalReview").html(totalNum);
            var goodPercent=goodNum/totalNum*100;
            var averagePercent=averageNum/totalNum*100;
            var badPercent=badNum/totalNum*100;
            if (isNaN(goodPercent)) goodPercent=0;
            if (isNaN(averagePercent)) averagePercent=0;
            if (isNaN(badPercent)) badPercent=0;
            $("#goodPercent").html(goodPercent.toFixed(2)+"%");
            $("#percent1").html(goodPercent.toFixed(2));
            $("#percent2").html(averagePercent.toFixed(2));
            $("#percent3").html(badPercent.toFixed(2));
            $("#bar1").attr("style","width:"+goodPercent+"%").attr("title",goodPercent+"%");
            $("#bar2").attr("style","width:"+averagePercent+"%").attr("title",averagePercent+"%");
            $("#bar3").attr("style","width:"+badPercent+"%").attr("title",badPercent+"%");
            $("#commentnum0").html(totalNum);
            $("#commentnum1").html(goodNum);
            $("#commentnum2").html(averageNum);
            $("#commentnum3").html(badNum);
            loadCmtContent(1,-1);	
          
        });
			 
    }
    var box='';
    function showComment(){

        jQuery.get('{$GetSiteUrl}plus/course/CosComment.ashx',
                  { action:"docomment", courseid:'{KS:Field:CourseID}'},
                    function (data) {
                        if(data=="error")
                        {
                        
                            alert("对不起，您没有购买该课程，不能评价");
                        }
                        else if(data=="weifu")
                        {
                            alert("您还没有确认付款，不能评价");
                        }
                        else if(data=="yiping")
                        {
                            alert("对不起，您已评价过");
                        }
                        else if(data=="isnull")
                        {
                         alert('请先登录!',"showlogin()");
                        }
                        else 
                        {
                            var str=data.split('@');
                       
                            var url=window.open('{$GetDomain}{M:G3InstallDir}course/MyCommentCourse.aspx');
                       
                        }

                    });

       
    }
     function oncommentlist() {
     
         $("#toploadcomment").hide();
            num++;
           loadCmtContent(num,type);
     
     }
    function loadCmt(obj,cmtType){
        
        $(obj).attr('class','active').siblings('span').attr('class','cmtlistnormal')
         type=cmtType;
         num=1;
          
        loadCmtContent(1,cmtType);
        
        
        
    }	

    function loadCmtContent(page,cmtType) {
      $("#toploadcomment").hide(); 
        var url="{$GetSiteUrl}plus/course/CosComment.ashx?action=GetCmtList&&flagtype=1&page=" + page+"&cmtType="+cmtType+"&courseid={KS:Field:CourseID}&orderType={$OrderType}";
      
        $.ajax({
            url: url,
            context: document.body,
            type: "GET",
            success: function (data) {
           
              if(data=='emptydata')
              {
                $("#toploadcomment").hide(); 
                 $("#con_comment1").html('<div class=\"empty\" >暂无评价</div>');
              }
              else 
              {
                if (data=='over')
					      {
                 $("#toploadcomment").hide(); 
              
                }
              else 
              {
               
                $("#con_comment1").html(data); 
                $("#toploadcomment").show(); 
                
              }
               
               
               }
                   
              
              
             
            }
        });
    }
    function showlogin(){
    location.href='{=GetRewriteUrl(userlogin)}';
	 
   }
</script>


  
          <section class="pj_box">
               <div class="box">
                   <div class="hpl">
                      <span class="percent" id="goodPercent">{KS:Field:PJrate}%</span>
                      <em>好评率</em>
                   </div>
                   <div class="barbox">
                       <div class="barleft">好评(<span id="percent1">{KS:PJrate}</span>%)</div>
                       <div class="barright"><div class="red" id="bar1" style="width:{KS:PJrate}%"></div></div>
                   </div>
                   <div class="barbox">
                      <div class="barleft">中评(<span id="percent2">{KS:midrate}</span>%)</div>
                      <div class="barright"><div class="red" id="bar2" style="width:{KS:midrate}%"></div></div>
                   </div>
                    <div class="barbox">
                        <div class="barleft">差评(<span id="percent3">{KS:badrate}</span>%)</div>
                        <div class="barright"><div class="red" id="bar3" style="width:{KS:badrate}%"></div></div>
                   </div>
               </div>
               <div class="line_d3"></div>
          </section>

     
     	]]>
  </label>
  <loopitem>
    <![CDATA[
     
               <section class="cmttop"> 
                   <span class="active" onclick="loadCmt(this,-1)"><b>全部</b><em id="commentnum0">1</em></span>
                   <span class="cmtlistnormal" onclick="loadCmt(this,0)"><b><img src="{$GetInstallDir}sysimg/default/good.gif" align="texttop" />好评</b><em id="commentnum1">1</em></span>
                   <span class="cmtlistnormal" onclick="loadCmt(this,1)"><b><img src="{$GetInstallDir}sysimg/default/middle.gif" align="texttop" />中评</b><em id="commentnum2">0</em></span>
                   <span class="cmtlistnormal" onclick="loadCmt(this,2)"><b><img src="{$GetInstallDir}sysimg/default/bad.gif" align="texttop" />差评</b><em id="commentnum3">0</em></span>
                  <div class="clear"></div>
          </section>
                            

          <section class="teacherintro" style="margin-top:0;">
             <div class="box2 pjlist">
                  <ul class="commentList_box" id="con_comment1">
                  </ul>
                  <div id="toploadcomment" class="loadtext" style="display:none">点击加载更多</div>
             </div>
  
          </section>
          <div class="line_d3"></div>
                            
           
                            
        
    ]]>
    </loopitem>

  <coursepjlist>
    <![CDATA[
    
		<li>
			  <div class="lct"><img src="{$UserFace}" onerror="replaceDefaultImg(this)" type="user" /></div>
			  <div class="rct">
				  <div class="name"><span>{$AddDate}</span><b>{$UserName}</b></div>
				  <div class="star"><div class="star_w" style="width:{$Cosnumber}em;"></div><div class="star_img"></div><span>{$CmtRank}</span></div>
				  <div class="info">{$Content}</div>
			  </div>
		 </li>

  ]]>
  </coursepjlist> 



</labeltemplate>