var isadded=0;
function addscore(type,itemid,t){
	if(isadded==1){
		alert('您已经评价过了!');
		return;
	}
	isadded=1;
	var t1='';
	if(t){
		t1='&t='+t
	}
	var goUrl = "ajax.vote.php?action=addscore";
	$.ajax({
			   type: "POST",
			   url: goUrl,
			   data: "itemid="+itemid+"&type="+type+t1,
			   success: function(msg){
				   
				   $num = parseInt($("#shu_"+type).html(),10)+1;
				   $("#shu_"+type).text($num);
				   if($num>50){
					   return;
				   }
				   
				   //$("#pillar_"+type).css("height",$num);
				   setPiaoStyle(type);
			   }
			}); 
}

var h0 = 0;
var h1 = 0;
var h2 = 0;
var h3 = 0;
var count = 0;

function setPiaoStyle(i)
{
	var h = 0;
	eval("h=h"+i+"+1;");
	count++;
	document.getElementById("pillar_0").style.height = Math.round(h0/count*50);
	document.getElementById("pillar_1").style.height = Math.round(h1/count*50);
	document.getElementById("pillar_2").style.height = Math.round(h2/count*50);
	document.getElementById("pillar_3").style.height = Math.round(h3/count*50);

	document.getElementById("pillar_"+i).style.height = Math.round(h/count*50);
}
function setPiaoStyleALL()
{
	h0 = document.getElementById("pillar_0").offsetHeight;
	h1 = document.getElementById("pillar_1").offsetHeight;
	h2 = document.getElementById("pillar_2").offsetHeight;
	h3 = document.getElementById("pillar_3").offsetHeight;
	count = h1+h2+h3+h0;
	
	if (count>0)
	{
		document.getElementById("pillar_0").style.height = Math.round(h0/count*50);
		document.getElementById("pillar_1").style.height = Math.round(h1/count*50);
		document.getElementById("pillar_2").style.height = Math.round(h2/count*50);
		document.getElementById("pillar_3").style.height = Math.round(h3/count*50);
	}
}

