// 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',
  'imgpop',
  'mailtoenabler',

  function(){
    var $ = jQuery,
        body = $('body').addClass('js-active'),
        msie =   $.browser.msie   &&  parseInt($.browser.version,10)<9;  // or: $('html').is('.msie');


    // labelize search input
    $('#qstr').labelizor();

    if (!window.EPLICA_loggedin)
    {

      //zebra tables
      $('tbody tr:nth-child(2n-1)').addClass('odd');
      //$('tbody tr:nth-child(2n)').addClass('even');


      //popup in articles
      $('.article .imagebox a.img')
          .each(function() {
            var imgsrc = $(this).find('img').attr('src').replace(/\/[^\/]+\/([^\/]+)$/, '/large/$1');
            $(this).attr('href', imgsrc)
          })
          .imgPopper({
              curtainColor : '#ffffff',
              curtainOpacity : '0.75',
              yOffset: 15
            });

      //Mailtoenabler
      $('.stafflist .netfang').mailtoEnabler();

    } // end loggedin
    
    //Open selected contries page in new window/tab
    $('.greach .fi_btn input').bind('click', function (e) {
        window.open($('.greach select option:selected').val());
      });

    //sitemap collapser
    $('.sitemap').Req('treecollapse', function() { 
        $(this).treeCollapse({ 
            branch: 'li:has(ul)', 
            doTogglers: 1, 
            toggler: '> a.expand',
            startOpen: 'ul.level1 > li:has(ul)'
          }); 
        });

    //remove flicker trick
    //$('#noflickerCSS').remove();

    // fontsizer
    $('.pagestyle').fontsizer();

    // validate all forms
    $('form').autoValidate();

  }
);
// **** /jqreq *****
