// encoding: utf-8
/*@cc_on/*@if(@_jscript_version<5.7)try{document.execCommand('BackgroundImageCache',0,1)}catch(e){}/*@end@*/

// ***** jqreq *****
Req.localPath = Req.localPath || '/skin/basic/'
Req(
  'eutils',
  'fontsizer',
  'autovalidate',
  'labelizor',
  'equalizeheights',
  'mailtoenabler',
  'imgpop',
  
  function(){
    var $ = jQuery;

    $('#qstr').labelizor();

    if (!window.EPLICA_loggedin) {

      $('div.home h2.boxhead, div.pgextra1 h2.boxhead, div.pgmain div.tbox h2.boxhead, div.nambox h1').wrapInner('<span></span>').addClass('js-hd');

      $('div.pgmain div.wrap, div.pgextra1 div.wrap').equalizeHeights();
      if($.browser.msie) { $('div.albums li').equalizeHeights(); };

      $('table.zebra tbody tr:nth-child(2n-1)').addClass('alt');


      $('.article .imagebox')
          .find('.imagelist li a')
            .imgPopper({
                curtainColor : '#867F7F',
                curtainOpacity : '0.8',
                fadeInSpeed:      200,
                fadeOutSpeed:     150
              })
          .end()
          .filter(function(){ return $(this).find('li').length > 1; })
              .Req('listscroller', function(){
                  $(this).listscroller({
                      item : 'li',
                      paging: true,
                      animation:   $.browser.msie && parseInt($.browser.version, 10) < 9 ? 'none' : 'crossfade',
                      windowSize: 1,
                      speed:  600
                    });
                });

      $('.people table.reportlist').Req('x/tablesorter-2.0.js', function(){
          $(this)
              .addClass('sortable')
              .tablesorter({
                  widgets: ['zebra'],
                  widgetZebra: {css: ["alt",""]},
                  textExtraction: 'complex'
                });
        });

      $('div.gallerybox div.boxbody a').append('<span class="mask"></span>');

      // pngfix for IE6
      if ($.browser.msie && $.browser.version < 7) {
        $('img[src$=".png"]').Req('x/ifixpng', function(){
            $(this).ifixpng();
          });
      }


      var imgbox = $('.article .imgbox .boxbody:has(a.zoomimg)');
      if(imgbox.length) {
        imgbox.append('<div class="poplinks" style="display:none;" />');

        $('div.pgs a', imgbox).each(function() {
            var _href = $(this).attr('href').split('?')[1].replace(/ListID=\d*&file=/,'');
            $('<a href="'+ _href +'"><img src="" alt="'+ $(this).attr('title') +'" /></a>').appendTo('.poplinks');
          });

        $('a.zoomimg, .poplinks a', imgbox)
            .imgPopper({
                curtainColor : '#867F7F',
                curtainOpacity : '0.8',
                fadeInSpeed:      200,
                fadeOutSpeed:     150
              });
      };
      
      

      // add magnifying glass to lightbox thumbnails
      $('.imagelist a.img').append('<span class="magnify" />');



      var imagelist = $('.mediagallery.imagelist li');
      $('img', imagelist).each(function() {
          var _href = $(this).attr('src').replace('/mlist/','/lighbox/');
          $(this).parent().attr('href',_href)
        })
      imagelist.find('a')
            .imgPopper({
                curtainColor : '#867F7F',
                curtainOpacity : '0.8',
                fadeInSpeed:      200,
                fadeOutSpeed:     150
              });


      $('div.namsgreinar div.boxbody ul')
          .find('> li')
              .each(function(i) {
                  if(i % 3 == 0) {
                    $(this).css({ clear : 'left' })
                  };
                });

    }

    $('#noflickerCSS').remove();
    $('div.pagestyle').fontsizer();
    $('form').autoValidate();

    if (!window.EPLICA_loggedin) {
      $('.netfang').mailtoEnabler();
    }
    
    
  }
);
// **** /jqreq *****