jQuery(
  function()
  {
    if ($("#mainmenu ul").length) {
      $("#mainmenu").superfish(
        {
          animation:    {opacity: 'show', height: 'show'},
          autoArrows:   false,
          delay:        0,
          dropShadows:  true,
          hoverClass:   'sfHover',
          speed:        'fast'
        }
      );
    }
    $('.accordion').accordion(
      {
        'active':       false,
        'autoHeight':   false,
        'collapsible':  true,
        'header':       'h2'
      }
    );
    if ($('.gallery').length) {
      $('.gallery a').attr(
        'href',
        function() {return this.rel}
      ).lightBox(
        {
          imageBlank:           '/img/lightbox-blank.gif',
          imageLoading:         '/img/lightbox-ico-loading.gif',
          imageBtnClose:        '/de/img/lightbox-btn-close.gif',
          imageBtnPrev:         '/de/img/lightbox-btn-prev.gif',
          imageBtnNext:         '/de/img/lightbox-btn-next.gif',
          containerResizeSpeed: 350,
          txtImage:             'Bild',
          txtOf:                'von'
        }
      );
    }

    $('a._blank').attr('target', '_blank');
  }
);

function initStatusPoll()
{
  $('#pm-inbox').append(' (<span class="pm-inbox-status">0</span>)');
  $('#pm-index').append(' <span class="pm-inbox-status">0</span>');
  statusPoll();
  setInterval(statusPoll, 60000);
} // end func initStatusPoll

function statusPoll()
{
  var t = new Date()
  $.getJSON(
    '/getAccountStatus.php?' + t.getTime(),
    function(data)
    {
      for (i in data) {
        $('.' + i).html(data[i]);
      }
    }
  )
} // end func pollStatus
