function getScore(itemId,obj,type){
	var req_url = 'http://data.yule.tom.com/proxy/voteinfo.jsp';
	var param   = "id="+itemId;
	var objs=document.getElementById(obj);
	new Ajax.Request(req_url , {method:'post',
		parameters:param,
		onComplete:function(xhr){
			eval("var json="+xhr.responseText);
			var score=json.score*1;
			var content=getNewStar(score);
			
			if(type==1){
				content=content+'<em>'+score+'</em>';
				}
				objs.innerHTML=content;
			
		}		
	});	
}


//ids: 1,2,3
//objs: movie_channel_star_y_
function getScoreByIds(ids, objs) {
	var req_url = 'http://data.yule.tom.com/proxy/votelist.jsp';
	var param   = "id="+ids;
	new Ajax.Request(req_url , {method:'post',
		parameters:param,
		onComplete:function(xhr){
			eval("var json="+xhr.responseText);
			
			var x=0;
			for(var i in json) {
				x++;
				var imgCon = getNewStar(json[i]*1);;
				
				document.getElementById(objs + x).innerHTML = imgCon;
			}
		}		
	});	
	
}

function getStar(score){
	if(score==0)return 0;
	if(score>0 && score<=1)return 1;
	if(score>1 && score<=2)return 2;
	if(score>2 && score<=3)return 3;
	if(score>3 && score<=4)return 4;
	if(score>4 && score<=5)return 5;
	
}
function getNewStar(score){
	if(typeof(score)=="undefined")return "";
    if(score==0)return "";
    if(score>0 && score<1) return "<img src=\"http://data.yule.tom.com/images/banxing.gif\" alt=\"\" />";
    if(score == 1) return "<img src=\"http://pics.yule.tom.com/images/xing.gif\" alt=\"\" />";
    if(score>1 && score<2) return "<img src=\"http://pics.yule.tom.com/images/xing.gif\" alt=\"\" /><img src=\"http://data.yule.tom.com/images/banxing.gif\" alt=\"\" />";
    if(score == 2) return "<img src=\"http://pics.yule.tom.com/images/xing.gif\" alt=\"\" /><img src=\"http://pics.yule.tom.com/images/xing.gif\" alt=\"\" />";
    if(score>2 && score<3) return "<img src=\"http://pics.yule.tom.com/images/xing.gif\" alt=\"\" /><img src=\"http://pics.yule.tom.com/images/xing.gif\" alt=\"\" /><img src=\"http://data.yule.tom.com/images/banxing.gif\" alt=\"\" />";
    if(score == 3) return "<img src=\"http://pics.yule.tom.com/images/xing.gif\" alt=\"\" /><img src=\"http://pics.yule.tom.com/images/xing.gif\" alt=\"\" /><img src=\"http://pics.yule.tom.com/images/xing.gif\" alt=\"\" />";
    if(score>3 && score<4) return "<img src=\"http://pics.yule.tom.com/images/xing.gif\" alt=\"\" /><img src=\"http://pics.yule.tom.com/images/xing.gif\" alt=\"\" /><img src=\"http://pics.yule.tom.com/images/xing.gif\" alt=\"\" /><img src=\"http://data.yule.tom.com/images/banxing.gif\" alt=\"\" />";
    if(score == 4) return "<img src=\"http://pics.yule.tom.com/images/xing.gif\" alt=\"\" /><img src=\"http://pics.yule.tom.com/images/xing.gif\" alt=\"\" /><img src=\"http://pics.yule.tom.com/images/xing.gif\" alt=\"\" /><img src=\"http://pics.yule.tom.com/images/xing.gif\" alt=\"\" />";
    if(score>4 && score<5) return "<img src=\"http://pics.yule.tom.com/images/xing.gif\" alt=\"\" /><img src=\"http://pics.yule.tom.com/images/xing.gif\" alt=\"\" /><img src=\"http://pics.yule.tom.com/images/xing.gif\" alt=\"\" /><img src=\"http://pics.yule.tom.com/images/xing.gif\" alt=\"\" /><img src=\"http://data.yule.tom.com/images/banxing.gif\" alt=\"\" />";
    if(score == 5) return "<img src=\"http://pics.yule.tom.com/images/xing.gif\" alt=\"\" /><img src=\"http://pics.yule.tom.com/images/xing.gif\" alt=\"\" /><img src=\"http://pics.yule.tom.com/images/xing.gif\" alt=\"\" /><img src=\"http://pics.yule.tom.com/images/xing.gif\" alt=\"\" /><img src=\"http://pics.yule.tom.com/images/xing.gif\" alt=\"\" />";



}
	function changecss(score){
	$("check0").value=score;
	$("vote_f").submit();
}
var xcall = {
  FNSC: (function() {
      var cc = document.body || document.getElementsByTagName("HEAD")[0];
      var c = document.createElement("DIV");
      c.style.display = "none";
      cc.appendChild(c);
      return c;
    })(),
  PROXY_TEXT_URL: "http://data.yule.tom.com/proxy/vote.jsp",
  call: function(fnCallback,id,divId,type){
   var VOTE_URL = "http://data.yule.tom.com/proxy/voteinfo1.jsp?id="+id+"&div="+divId+"&type="+type;
    var sc = document.createElement("SCRIPT");
    sc.type = "text/javascript";
    sc.src = this.PROXY_TEXT_URL + "?XCALL_URL=" + encodeURIComponent(VOTE_URL) + "&XCALL_FNCB=" + fnCallback;
    this.FNSC.appendChild(sc);
  }
}
var xvote = {
  FNSC: (function() {
      var cc = document.body || document.getElementsByTagName("HEAD")[0];
      var c = document.createElement("DIV");
      c.style.display = "none";
      cc.appendChild(c);
      return c;
    })(),
  PROXY_TEXT_URL: "http://data.yule.tom.com/proxy/vote.jsp",
  call: function(fnCallback,id,divId){
   var VOTE_URL = "http://data.yule.tom.com/proxy/votelist1.jsp?id="+id+"&div="+divId;
    var sc = document.createElement("SCRIPT");
    sc.type = "text/javascript";
    sc.src = this.PROXY_TEXT_URL + "?XCALL_URL=" + encodeURIComponent(VOTE_URL) + "&XCALL_FNCB=" + fnCallback;
    this.FNSC.appendChild(sc);
  }
}
function fillVoteList(resp){
    eval("var json="+resp.text);
    var x=0;
    var objs = json.divId;
    for(var i in json.votes){
         x++;
		 var imgCon = "";
		 var score = getStar(json.votes[i]);
		for(var j=0;j<score;j++) {
				imgCon += "<img src=\"http://data.yule.tom.com/images/xing.gif\" alt=\"\" />";
			}
	    document.getElementById(objs + x).innerHTML = imgCon;
    }
}
function fillTqybFTW(resp) {
    eval("var json="+resp.text);
	var score=json.score*1;
	var count = getStar(score);
	var content="";
	for(var i=0;i<count;i++){
		content=content+'<img src="http://data.yule.tom.com/images/xing.gif" alt="" />';
	}
	if(json.type==1){
				content=content+'<em>'+score+'</em>';
	}
	document.getElementById(json.divId).innerHTML=content;
}
