var elite_florist_keyboard_navigation_loop = function (elem) {
  var elite_florist_tabbable = elem.find('select, input, textarea, button, a').filter(':visible');
  var elite_florist_firstTabbable = elite_florist_tabbable.first();
  var elite_florist_lastTabbable = elite_florist_tabbable.last();
  elite_florist_firstTabbable.focus();

  elite_florist_lastTabbable.on('keydown', function (e) {
    if ((e.which === 9 && !e.shiftKey)) {
      e.preventDefault();
      elite_florist_firstTabbable.focus();
    }
  });

  elite_florist_firstTabbable.on('keydown', function (e) {
    if ((e.which === 9 && e.shiftKey)) {
      e.preventDefault();
      elite_florist_lastTabbable.focus();
    }
  });

  elem.on('keyup', function (e) {
    if (e.keyCode === 27) {
      elem.hide();
    };
  });
};