  //--> Kommentare -------------------------
  //Zeigt die Kommentare an.
  function showComments(pageNumber,objectID) {
    var data = 'pageNumber=' + pageNumber + '&objectID=' + objectID + '&object=' + object;
    $.ajax({
      type: "GET",
      url: "/resources/js/comment/ajax_showComments.php",
      data: data,
      success: function(msg){
        $('#comments').empty();
        $('<span>'+msg+'</span>').appendTo('#comments');
      }
    });
  }
  

$(document).ready(function() {

  //Blätterfunktion
  $('div[rel*=pageComment]').live("click",function() {
    pageID = $(this).attr('id');
    $('#comments').fadeOut('slow', function() {
      showComments(pageID,currentId); //Zeigt
      $('#comments').fadeIn('slow');
    });
  });
  

  
  //Fügt neuen Kommentar ein
  $('a[name=submitComment]').live("click",function() {
    var comment = $('textarea[name=comment]');
    var data = 'comment=' + comment.val() + '&form_action=addComment&objectID=' + currentId + '&object=' + object;

    $('form[name=addComment]').fadeOut('slow');
    $('.loader').fadeIn('slow');

    if (comment.val() != "") {
      $.ajax({
        type: "POST",
        url: "/resources/js/comment/ajax.php",
        data: data,
        success: function(request){
          if (request == "1") {
            showComments(1,currentId,object);
          }else {
          alert(request);
          }
        }
      });
    }
  });
  
  
  
});

