$(document).ready(function() {
    setupZoom();
    
    $('a.zoomin').click(function() {
        $('table.geruest').fadeTo('slow', 0.0, function() {  
        }); 
    });
    
    $('img#ZoomImage').click(function() {
        $('table.geruest').delay(500).fadeTo('slow', 1.0, function() { 
        }); 
    });
    
    // Zoomtext einblenden
  $('img.artworkzoom').each(function(index){
    var $picture = $(this);
    //alert("dsadas");
    $picture.parent().append("<div class='enlarge'>Click to zoom</div>");
    var $enlarge = $picture.parent().find('.enlarge');
    $enlarge.hide();
    $enlarge.fadeIn('fast').delay(5000).fadeOut('fast');
  });
  
  $('div.enlarge').hover(function(){$(this).show();$(this).show();});
  
  // Zoomtext einblenden
  $('img#ZoomImage').each(function(index){
    var $picture = $(this);
    $picture.parent().append("<div class='enlarge'>Click to close Zoom</div>");
    var $enlarge = $picture.parent().find('.enlarge');
    $enlarge.hide();
    $picture.mouseover(function(){
      $enlarge.fadeIn('fast').delay(5000).fadeOut('fast');
    }).mouseout(function(){
      $enlarge.fadeOut('fast');
    });
  });


  if($('.groupexhibition').length > 0 && $('.groupexhibition').find('h2').length == 0) {
    $('.groupexhibition').remove();
  }

  if($('.relatedlinks').length > 0 && $('.relatedlinks').find('a').length == 0) {
    $('.relatedlinks').remove();
  }
  
  //console.debug($("div.thumbitem:nth-child(4n)"));
  $("div.tx-hetzlergallery-pi1 div.thumbitem:nth-child(3n+1)").after('<br style="clear:both;" />');

});

