var vote_timer;
function doVote(no){
	var id_user_session =$("#id_user_session").val();
	var id_user_cookie=Get_Cookie("id_user");
	var id_user = parseInt(id_user_cookie)>0?id_user_cookie:(parseInt(id_user_session)>0?id_user_session:0);
	if(id_user==0){
		var dialog_obj = {title:"Login",html:"<div style='text-align:left;margin-top:10px;'><a href='"+server_url+"login' style='color:#A9BA0A;text-decoration:none;' class='hijax_link green_anchor'>Login</a> pentru a putea vota.</div>",width:420};
		addDialog(dialog_obj);
		init();
		return;
	}
	$("#loading_vote").show();
	$("#stars_holder").hide();
	var data = "vote="+no+"&the_id_item="+$("#the_id_item").val();
	$.ajax({
		type: "POST",
		url: server_url_v2+"doVote.php",
		data: data,
		success: function(msg){
			$("#loading_vote").hide();
			$("#stars_holder").show();
			var temp=msg.split("~");
			if(temp[1]=="err"){
				var dialog_obj = {title:"Vot",html:"<div style='text-align:left;margin-top:10px;'>Ai mai votat o data acest articol cu nota "+temp[0]+".</div>",width:420};
				addDialog(dialog_obj);
			}else{
				var temp2=temp[0].split("-");
				var nv = temp2[0]=="1"?"1 vot":temp2[0]+" voturi";
				$("#countvotes").val(nv);
				$("#no_votes").html(nv);
				$("#therating").html(temp2[1]);
				$gw = parseInt((parseFloat(temp2[1])*210)/10);
				$("#stars_gold").width($gw);
			}
		}
	});
}
function doStarOut(){
	$("#stars_green").hide();
	$("#no_votes").html($("#countvotes").val());
}
function starOut(){
	clearTimeout(vote_timer);
	vote_timer = setTimeout("doStarOut()", 100);
}
function starOver(no){
	clearTimeout(vote_timer);
	$("#stars_green").show();
	$("#stars_green").width((21*no));
	var html = no==1?no+" stea":no+" stele";
	$("#no_votes").html(html);
}
