// 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',
  'autovalidate',
  'labelizor',
  'imgpop',
  'equalizeheights',
  'anchortags',
  'mailtoenabler',

  function(){
    var $ = jQuery;

    // labelize search input
    $('#qstr').labelizor();

    //equalizeheights
    $('.pgmain .wrap, .pgextra2 .wrap').equalizeHeights();
    $('.pgmain .mbox').equalizeHeights();

    var mainLast = $('.pgmain .main-info.last').wrapAll('<span class="main-info-last" />'); 
    $('.pgmain .main-info, .main-info-last').not('.main-info.last').equalizeHeights();

    if (!window.EPLICA_loggedin)
    {

      //zebra tables
      $('tbody tr:nth-child(2n-1)').addClass('odd');


      //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
            });

      $(".netfang").mailtoEnabler();


      // Blockquote extra element 
      var bquote = $('.pgmain .article').find('blockquote');
      bquote.each(function() {
        $(this).wrapInner('<span />');
      });

    } // end loggedin

    //sitemap collapser
    $('.sitemap').Req('treecollapse', function() { 
        $(this).treeCollapse({ 
            branch: 'li:has(ul)', 
            doTogglers: 1, 
            toggler: '> a.expand',
            startOpen: 'ul.level1 > li:has(ul)'
          }); 
        });
	// Ajax get for employees
	$('div.people').Req('/bitar/common/personas/loadEmployee.js', function(){ this.eplicaEmployeeLoader({ emailSelector: '.netfang span' }); });
	
	
    $('#noflickerCSS').remove();
    $('form').autoValidate();


   // Anchortags
    var anchors = $('div.pgmain a')
    anchors
        .anchorTags({
            usePatterns:  ['doc', 'pdf', 'xls']
          });

  }
);
// **** /jqreq *****

