$(document).ready(function()
{
//  Shadowbox.init({ flashParams: {movie:'/flash/player.swf'} });
  Shadowbox.init({ pathFLV:'/flash/', handleOversize:'none', modal:true });

  //$('a.pr_image').shadowbox({ handleOversize:'none', gallery: clickedLink.attr('rel'), title:clickedLink.attr('title') });

  $(".oe2tooltip").tooltip(
  {
    track:true,
    delay:0,
    showURL:false,
    opacity:1,
    fixPNG:true,
    extraClass: "tooltip-small",
    top: -95,
    left: 5,
    bodyHandler: function()
    {
      return $(this).html();
    }
  });

  $(".oe2tooltip-l").tooltip(
  {
    track:true,
    delay:0,
    showURL:false,
    opacity:1,
    fixPNG:true,
    extraClass: "tooltip-large",
    top: -205,
    left: 5,
    bodyHandler: function()
    {
      return $(this).html();
    }
  });

  $(".abo_events", "#abonnements").prepend(function (){ return '<p><span class="abo_events-link">' + $(this).attr('title') + '</span></p>' }).find('.apollo_eventlist').hide();

  $('.abo_events-link').live('click', function ()
  {
    //$(this).next("ul").animate({height:"toggle"}, 500);
    $(this).parent().next('div').slideToggle(500);
    return false;
  })

  $.fn.apolloSeats = function()
  {
    var elemSelector = $(this).selector.split(' ');
    elemSelector = elemSelector[(elemSelector.length - 1)];

    $(elemSelector, '#content_preis-table').hover(
      function ()
      { $(elemSelector, '#content_preis-images').show(); },
      function ()
      { $(elemSelector, '#content_preis-images').hide(); }
    )
  };


  //$("li.filelink > a", "#rightcol").oe2Slide();

  $('.price-cat-1', '#content_preis-table').apolloSeats();
  $('.price-cat-2', '#content_preis-table').apolloSeats();
  $('.price-cat-3', '#content_preis-table').apolloSeats();
  $('.price-cat-all', '#content_preis-table').apolloSeats();

  if (!navigator.javaEnabled())
  {
    $('.java-only').html('<p>Für diese Funktion benötigen Sie die <a href="http://www.java.com/de/download/">kostenlose Java-Software (Java Runtime Environment)</a>.</p>')
  }


  $('.content_imglist a').click(function ()
  {
    var clickedElem = $(this);
    var bigImage = $('#bigImage');
    var imageLoaded = false;
    $.ajax({ type: "POST", url: "/_ajax.content-galerien.php", dataType: "json", data:{ id:clickedElem.attr("rel") },
    success: function(json)
    {
      bigImage.fadeOut('slow',
      function ()
      {
        bigImage.width(json.width);
        bigImage.height(json.height);
        bigImage.attr('src', json.url).load(
        function ()
        {
          $(this).fadeIn();
        });
      });

      $('#downloadLink').html('<p>Download:<br>' + json.download + '</p>');
    }
  });
    return false;
  });

  $('#abs_bezahlung').change(function (value)
  {
    var container_id = '#' + $(this).val();
    $('.type-visible').toggleClass('type-hidden').toggleClass('type-visible');
    $(container_id).toggleClass('type-hidden').toggleClass('type-visible');
  });

});

