function downpoint(username,path){
	//alert(path);
	
	$.ajax({ 
	    		url: "/index.php/ajax/downpoint",
	    		type: 'post',
	     		data: "username="+username+"&path="+path,
        		success: function(t) {
	   				if(t=='error')
	   				downpoint();

        }

    });	
		
}
function doListCallback(data)
{
	document.getElementById("cnum").innerHTML = data.num;
}
function callbackRate(path,people,totalvalue){
	var s=path.replace(/\/source\//g,'');
	var element = document.createElement('script');
		element.setAttribute("charset", "utf-8");
		element.setAttribute('src', 'http://download.csdn.net/index.php/rest/users/addscoreByratings/'+s);
		document.body.appendChild(element);
}
function doPostCallback(path,username,num,title,id){
	/*element.setAttribute('src', 'http://download.csdn.net/index.php?c=ajax&m=downpoint1&'+s);
	 * var s="username="+username+"&path="+path+"&id="+id+"&title="+title;
	 * */

	if(document.getElementById("cnum")!=null)
	document.getElementById("cnum").innerHTML = num;
	var s =path.replace(/\/source\//g,'');	
	var element = document.createElement('script');
		element.setAttribute("charset", "utf-8");
		element.setAttribute('src', 'http://download.csdn.net/index.php/rest/users/addscoreByremark/'+s);
		document.body.appendChild(element);	
}
    function mknumList(){
    	data=JsCommentJson.comments_num;
    	lenth=data.length;
    	for(i=0;i<lenth;i++){
    		document.getElementById(data[i].divid).innerHTML=data[i].num;
    	}
    }
    //获得某资源的打分
    function mkratelist(){
    	data=JsRateJson.rate_info;
    	lenth=data.length;
    	for(i=0;i<lenth;i++){
    		curhtml=ratehtml(data[i].value);
    		document.getElementById(data[i].divid).innerHTML=curhtml;
    	}
    }
    function ratehtml(value){
    	var showstr="";
    	var grade=0;
    	switch(value){
    		case 0:showstr="还没人打分";grade=0;break;
    		case 1:showstr="不怎么样";grade=1;break;
    		case 2:showstr="一般";grade=2;break;
    		case 3:showstr="还行";grade=3;break;
    		case 4:showstr="不错,值得推荐";grade=4;break;
    		case 5:showstr="非常棒,强力推荐";grade=5;break;
    	}
    	html='<span title="'+showstr+'">';
	    for(j=0;j<grade;j++){
	    	html+='<img alt="*" src="/images/sts.gif"/>';
	    }
	    n=5-grade;
	    for(k=0;k<n;k++){
	    	html+='<img alt="*" src="/images/nsts.gif"/>';	
	    }
	    html+='</span>';
	    return html;
    }
    function mkcommentList(){
    	
    	usercomment=JsCommentJson.usercomments;
        lenth=usercomment.length;
    	
    	if(lenth>0)
    	{
    		html="";
    		for(i=0;i<lenth;i++){
	    		html+='<dl class="articleContent">';
	    		html+='<dt>评论:<a href="'+ usercomment[i].self +'">'+ usercomment[i].title +'</a>　　　<span>评论：'+ usercomment[i].commentnums +'条</span></dt>';
	    		html+='<dd>'+ usercomment[i].description +'</dd>';
	    		html+='<dd class="articleXq"><code><a href="/user/'+usercomment[i].username+'">'+ usercomment[i].username +'</a></code>   <span>发表于:'+ usercomment[i].pubdate+'</span></dd>';
	    		html+='</dl>';
    		}
    		}
    	else{
    		html='<div style="text-align:center">尚未有最新评论！</div>';
    	}
    	
    	document.getElementById("commentlist").innerHTML=html;
    
    }
    function getgoodsourcels(){
    	var goodsource=JsRateJson.goodsource;
		if(goodsource!=""){
			lenth=goodsource.length;
			idstr="";
			
			var curidstr=""
			for(i=0;i<lenth;i++){
				curpath=goodsource[i].path;
				curidarray=curpath.split("/");
				curid=curidarray[2];
	
				curidstr+=curid+"-";
			}	
				$.ajax({ 
		    		url: "/index.php/ajax/getsourceinfobyid",
		    		type: 'post',
		     		data: "sourceidls="+curidstr,
		     		dataType:"json",
	        		success: function(t) {
		   				var htmlout="";
		   				for(i=0;i<t.length;i++)
		   				{
		   					htmlout+="<li><a href='http://download.csdn.net/source/"+ t[i].id+"'>" + t[i].title+"</a></li>";
		   				}
		   							
	        	document.getElementById("goodsourcelist").innerHTML=htmlout;
	        }
	
	    });	
		
	}
    }
 
  