// jquery based javascript for burnus
// zeitform Internet Dienste OHG, 2009

function showtext (id) { 
  $('#' + id).show(); 
}

function hidetext (id) { 
  $('#' + id).hide(); 
}

function subNavToggle(id) {
  if (id) { 
    $('#subproducts ul').hide();
    $('#smenu' + id).show();
  } else {
    $('#smenu1').show();
  }
}

function infoExplode(start, explode) {
  if ($('#' + explode).is(':visible')) {
    $('#' + explode).fadeOut('slow');
    this.lastElement = false;
  } else {
    if (this.lastElement) {
      //$(this.lastElement).fadeOut('slow');
      $('.zoombox').fadeOut('slow');
    } 
    $('#' + explode).fadeIn('slow');
    this.lastElement = explode;
  }
}

$(function() {

  // external links
  $('a[rel=external]').attr('target', '_blank');

  // bilddatenbank
  $('#pictures tr').each(function(){
    var ctx = this;
    // hide all images but the first
    $('div.previewpop', $(ctx)).each(function (i) {
      if (i > 0) $(this).hide();
    });
    // on hover hide all images, show the element before the one before (prev().prev())
    $('div.download a', $(ctx)).hover(function() {  
      var rel = $(this).attr("rel");
      $('div.previewpop', $(ctx)).hide();
      $('div.' + rel).show();
    },function() {});
  });

});
