(function($) {
  var Apard = window.Apard || {};

  /**
   * Initialize Apard scripts
   */
  Apard.init = function() {
    // Responsive top menu
    $('.menu-block-apard-top-menu, .menu-block-apard-top-menu-intranet').children('ul.menu').flexNav({
      'breakpoint': 980,
      'buttonText': ''
    });

    // Responsive main menu
    $('.menu-block-apard-main-menu, .menu-block-apard-main-menu-intranet').children('ul.menu').flexNav({
      'breakpoint': 980,
      'buttonText': 'Menu'
    });

    // Handle header search input
    $('.block-search-form .form-item-search-block-form .form-text')
      .focus(function() {
        if ($(this).val() == 'Rechercher') {
          $(this).val('');
        }
      })
      .blur(function() {
        if ($(this).val() == '') {
          $(this).val('Rechercher');
        }
      })
      .trigger('blur');
  };

  // Launch on window ready
  $(Apard.init);

})(jQuery);