var InternetConnection = (function () {
  'use strict';

  var errorMessage = $('.js-no-interent');

  return {
    init: init
  };

  function init() {
    statusChange();
    window.addEventListener('online',  statusChange);
    window.addEventListener('offline', statusChange);
  }

  function statusChange() {
    var isOnline = navigator.onLine;
    if (isOnline) {
      errorMessage.addClass('hidden');
    } else {
      errorMessage.removeClass('hidden');
    }
  }

}());