$(document).ready(function() {
  // autocreation for drupal imag enodes
  // select links, that contain images with class "image" AND "thumbnail"
  // overwrite only in case they are not manually set as thickbox
  $("a[img.image.thumbnail]").not(".thickbox").click(TB_drupal_init);

  // now care for those links inside the gallery-listing
  $("ul.galleries a[img.image.thumbnail]").not(".thickbox").unclick(TB_drupal_init);
});


function TB_drupal_init() {
  var i = $(this).children("img");
  var t = i.title() || i.attr("alt") || null;
  var u = i.src().replace(".thumbnail","");
  var g = null; //not yet supported, would require the rewrite

  TB_show(t,u,g);
  this.blur();
  return false;
}
