$().ready(function(){
    $("#newComment").submit(function(){
        var params = $(this).serialize();
        $.ajax({
            type: "POST",
            url: $(this).attr("action") + "?ajax=true",
            data: params,
            success: function(msg){
                $("#comments").prepend(msg);
                $("#commentCount").html( parseInt($("#commentCount").html()) + 1 );
                $("#commentTextArea").html("");
            }
        });
        return false;
    });
    $("#setFavorite").click(function(){
        $.ajax({
            type: "GET",
            url: $("#setFavorite").attr("href") + "?ajax=true",
            success: function(msg){
                if ( msg == "1"){
                    $("#setFavorite").hide();
                    $("#favoriteSet").show();
                }
            }
        });
        return false;
    });
    $("#setFavoriteUser").click(function(){
        $.ajax({
            type: "GET",
            url: $("#setFavoriteUser").attr("href") + "?ajax=true",
            success: function(msg){
                if ( msg == "1"){
                    $("#setFavoriteUser").hide();
                    $("#favoriteUserSet").show();
                }
            }
        });
        return false;
    });
    $("#notAppropriate").click(function(){
        $.ajax({
            type: "GET",
            url: $("#notAppropriate").attr("href") + "?ajax=true",
            success: function(msg){
                if ( msg == "1"){
                    $("#notAppropriate").hide();
                    $("#notAppropriateSet").show();
                }
            }
        });
        return false;
    });
});
