$(document).ready(function(){

  /**
  * user clicked on "And X other works from the same author" link
  *
  * get work IDs from rel attribute and display those works
  **/
  
  $('.same_author_collapsed a').live("click", function(){
        
    var collapsed_works = $(this).attr('rel');
    
    $.get('/ajax/wck_ajax_works_list.php', { 'works': collapsed_works },
    function(data){    
      // show those works
      $('#cw'+collapsed_works).html('<hr />'+data);
      $('#cw'+collapsed_works).fadeIn('slow');
    });
            
    return false;        
  });
  /**********************************/
  
  
  // open links with class .external_link in a new window/tab
  $('a.external_link').click(function() {
    window.open($(this).attr('href'));
    return false;
  });
  
  // Hide elements reserved for people with no javascript
  $('.noscript').hide();


});

