function vote(container, direction){
	elem = $(container).parent().find(".vote-score");
	$(elem).hide(300);
    $.ajax({
        type: "POST",
        dataType: "json",
        url: $(container).attr('href'),
        success: function(json){
            if (json.success){
               $(elem).html(""+json.score.score+"/"+json.score.num_votes+"");
               $(elem).show(200);
            }
        },
        error: function(){
        	alert('asdfasddf');
        }
    });
}	

function qvote(container, direction){
	elem = $(container).parent().find(".qvote-score");
    $(elem).fadeOut();
    $.ajax({
        type: "POST",
        dataType: "json",
        cache: false,
        data: 'rnd='+Math.random(),
        url: $(container).attr('href'),
        success: function(json){
    		if (json != null){
	            if (json.success == true){
	               $(elem).html(""+json.score.score);
	            }else{
	            	alert(json.error_message);
	            }
    		}
            $(elem).fadeIn();
        },
        error: function(){
        	$(elem).fadeIn();
        	alert("No response :(");
        }
    });
}	

