//= require require_config

if(MAS.supports.fonts && MAS.bootstrap.fontsUrl) {

  require(['webfonts'], function () {
    var fontConfig = {
      custom: {
        families: ['museo_sans', 'icon-font'],
        urls: [MAS.bootstrap.fontsUrl]
      }
    };
    WebFont.load(fontConfig);
  })
}

require(['analytics'], function (analytics) {
  analytics.scrollTracking({
    el: '.editorial',
    triggerPoints: [0.25, 0.5, 0.75, 1]
  });
});

require([MAS.bootstrap.I18n_locale, 'collapsable'], function (Text, Collapsable) {
  var articleCollapsables = new Collapsable({
    showOnlyFirst:true,
    showIcon:true,
    textString: {
      showThisSection: Text.show || 'Show this section',
      hideThisSection: Text.hide || 'Hide this section'
    }
  });
  var primaryNav = new Collapsable({
    closeOffFocus:true,
    accordion:true,
    triggerEl: '#primary-nav > li > a',
    targetEl: '.primary-nav__dropdown',
    parentWrapper: '#primary-nav'
  });
  var mobileNav = new Collapsable({
    closeOffFocus:true,
    accordion:true,
    triggerEl: '.mobile-nav a',
    targetType: 'href',
    parentWrapper: '#primary-nav'
  });
});

//= require require_config

if(MAS.supports.fonts && MAS.bootstrap.fontsUrl) {

  require(['webfonts'], function () {
    var fontConfig = {
      custom: {
        families: ['museo_sans', 'icon-font'],
        urls: [MAS.bootstrap.fontsUrl]
      }
    };
    WebFont.load(fontConfig);
  })
}

require(['analytics'], function (analytics) {
  analytics.scrollTracking({
    el: '.editorial',
    triggerPoints: [0.25, 0.5, 0.75, 1]
  });
});

require([MAS.bootstrap.I18n_locale, 'collapsable'], function (Text, Collapsable) {
  var articleCollapsables = new Collapsable({
    showOnlyFirst:true,
    showIcon:true,
    textString: {
      showThisSection: Text.show || 'Show this section',
      hideThisSection: Text.hide || 'Hide this section'
    }
  });
  var primaryNav = new Collapsable({
    closeOffFocus:true,
    accordion:true,
    triggerEl: '#primary-nav > li > a',
    targetEl: '.primary-nav__dropdown',
    parentWrapper: '#primary-nav'
  });
  var mobileNav = new Collapsable({
    closeOffFocus:false,
    accordion:true,
    triggerEl: '.mobile-nav a',
    targetType: 'href',
    parentWrapper: '#primary-nav'
  });
});

Disable menu closing on focusout
Disable menu closing on focusout
