$(document).ready(function() {
    
    $("#vote-valid").click(function(event){
        $.post($(this).attr('vote_uri'), {}, function(data){
            if(true == data){
                $("#vote-buttons").fadeOut(300, function(){
                    $("#vote-saved").fadeIn(300);
                });
            }
            else{
                // error
            }
        }, 'json');
        return false;
    });
    
    $("#vote-invalid").click(function(event){
        $.post($(this).attr('vote_uri'), {}, function(data){
            if(true == data){
                $("#vote-buttons").fadeOut(300, function(){
                    $("#vote-saved").fadeIn(300);
                });
            }
            else{
                // error
            }
        }, 'json');
        return false;
    });
    
    $("#datasheet-valid-plus").click(function(){
        $.post($(this).attr('vote_uri'), {}, function(data){
            if(true == data){
                $("#datasheet-vote-buttons").fadeOut(300, function(){
                    $("#datasheet-vote-info").fadeIn(300);
                });
            }
            else{
                // error
            }
        }, 'json');
        return false;
    });

    $("#datasheet-valid-minus").click(function(){
        $.post($(this).attr('vote_uri'), {}, function(data){
            if(true == data){
                $("#datasheet-vote-buttons").fadeOut(300, function(){
                    $("#datasheet-vote-info").fadeIn(300);
                });
            }
            else{
                // error
            }
        }, 'json');
        return false;
    });
});
