// encoding: utf-8
/*@cc_on/*@if(@_jscript_version<5.7)try{document.execCommand('BackgroundImageCache',0,1)}catch(e){}/*@end@*/

// ***** jqreq *****
Req(
  'fontsizer',
  'autovalidate',
  'x/ifixpng',
  'x/innerfade',
  'imgpop',
  'popups',
  'equalizeheights',
  
  function(){
    var $ = jQuery;

    //remove flicker trick
    $('#noflickerCSS').remove();
    
    //dhtml mnav
    $('.mnav ul.level1 > li').each(function() {
        $(this)
            .bind('mouseenter', function() {
                $(this).addClass('hovered').find('ul.level2').addClass('open');
              })
            .bind('mouseleave', function() {
                $(this).removeClass('hovered').find('ul.level2').removeClass('open');
              });
      });


    $('.pgmain .wrap, .pgextra1 .wrap, .pgextra2 .wrap').equalizeHeights();
    $('body').addClass('heightfixed');
      
      
    if (!window.EPLICA_loggedin)
    {
      


      // pngfix for IE6
      if ($.browser.msie && $.browser.version < 7) {
        $('img[src$=".png"]').ifixpng();
      }
      
      
      //popup in articles
      $('div.article div.imgbox a:has(img)')
          .each(function() {
            var imgsrc = $(this).find('img').attr('src').replace(/\/[^\/]+\/([^\/]+)$/, '/large/$1');
            $(this).attr('href', imgsrc)
          }) 
          .imgPopper({
              curtainColor : '#000000',
              curtainOpacity : '0.75'
            });
            
            
      $('a.video').each(function(i) {
          $(this).click(function () {
                  $('#video').remove();
                  var href = $(this).attr('href');
                  $(this).after('' +
                      '<p id="video"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8.0.0.0" width="540" height="346">' +
                      '<param name="movie" value="/bitar/common/media/mediaplayer.swf" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" />' +
                      '<param name="flashVars" value="file=' + href + '&type=video&width=580&height=326&bufferlength=8&autostart=true" />' +
                      '<embed src="/bitar/common/media/mediaplayer.swf"' +
                      'flashVars="file=' + href + '&type=video&width=580&height=326&bufferlength=8&autostart=true"' +
                      'width="540" height="346" wmode="transparent" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />' +
                      '</object></p>' +
                    '');
                return false;
              //}
            });
        });

    }
    
    $('.popup, .glossary').popUps({
      target  : 'bigpopup',
      width   : 550,
      height  : 350,
      minimal : 1
    });
    
    $('.scrolladvert .boxbody').addClass('scrolladvert-active')
        .find('ul').innerfade({
            animationtype: 'fade',
            speed: 1000,
            timeout: 5000,
            type: 'sequence',
            containerheight: '4em'
          });
    
          

      
    // fontsizer
    $('div.pagestyle').fontsizer();

    // validate all forms
    $('form').autoValidate();
        
  }
);
// **** /jqreq *****
