// 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',
  'mailtoenabler',
  'imgpop',

  function(){
    var $ = jQuery,
        body = $('body').addClass('js-active'),
        msie =   $('html').is('.msie');

    if (!window.EPLICA_loggedin)
    {

      //zebra tables
      $('tbody tr:nth-child(2n-1)').addClass('alt');

      $('.netfang').mailtoEnabler();

    } // end loggedin

    // Snowfall
    $('.xmas .pghead .wrap')
        .Req('x/snowfall', function () {
            // let it snow, let it snow, let it snow...
            var snowCfg = {
                //flakeCount : 35,
                //flakeColor : '#fff',
                //flakeIndex: 999999,
                minSize : 1,
                maxSize : 3
                //minSpeed : 1,
                //maxSpeed : 5,
                //round : false,
                //shadow : false,
                //collection : false,
                //collectionHeight : 40
            };
        $(this).snowfall(snowCfg); 
        });

    //sitemap collapser
    $('.sitemap').Req('treecollapse', function() { 
        $(this).treeCollapse({ 
            branch: 'li:has(ul)', 
            doTogglers: 1, 
            toggler: '> a.expand',
            startOpen: 'ul.level1 > li:has(ul)'
          }); 
        });
    
    //Imageswitcher on product page.
    var imgsrc,
         product = $('.product');
    product.find('.imgthumbs li a').bind('click', function (e) {
        imgsrc = $(this).attr('href');
        product.find('#mainImage').attr('src', imgsrc);
        imgsrc = product.find('#mainImage').attr('src').replace('/302/', '/602/');
        product.find('.zoom').attr('href', imgsrc)
        e.preventDefault();
      });

      //popup in articles
      $('.zoom')
          .each(function() {
            imgsrc = product.find('#mainImage').attr('src').replace('/302/', '/602/');
            $(this).attr('href', imgsrc)
          })
          .imgPopper({
              curtainColor : '#ffffff',
              curtainOpacity : '0.75',
              yOffset: 15
            });
        


    $('#noflickerCSS').remove();
    $('.pagestyle').fontsizer();
    $('form').autoValidate();

  }
);
// **** /jqreq *****

