//= require 'redmine_jquery-1.11.1-ui-1.11.0-ujs-3.1.4'
//= require polyfill


//= require namespaces
//= require erui
//= require shortcuts
//= require 'utils/schedule'

//= require 'moment.js'
//= require 'jqueryui-editable.js'
//= require 'redmine_application'
//= require 'context_menu'
//= require 'easy_inline_edit.js'
//= require 'jquery.infinitescroll.js'

//= require 'modal_selector'
//= require 'jquery.perfect-scrollbar.js'
//= require 'jquery.base64.js'
//= require 'easy_distributed_tasks.js'
//= require 'jquery.easyquery.js'

//= require ckeditor_ops.js

//= require 'print'
//= require 'easy_background_services'

//= require_self


//= require 'easy_anchor_scroll.js'
//= require 'jquery.easy_datepicker.js'
//= require 'easy_taggables.js'
//= require 'entity_tabs.js'
//= require 'jquery.Jcrop.js'


//= require 'mustache.js'
//= require 'common/view_sass_data'
//= require 'common/resize_sensor.js'
//= require 'common/constants.js'
//= require 'common/templates.js'
//= require 'common/core.js'
//= require 'common/widget.js'
//= require 'common/view_root.js'
//= require 'common/view_sticky.js'
//= require 'common/tooltip.js'
//= require 'common/issue.js'
//= require 'common/user.js'
//= require 'common/layout.js'
//= require 'common/root_model.js'
//= require 'common/issue_card_widget.js'
//= require 'utils/scheduled_tasks.js'
//= require 'utils/drag_and_drop.js'
//= require 'utils/autocomplete.js'
//= require 'utils/clipboard.js'


//= require 'agile/agile_model.js'
//= require 'agile/agile_view.js'
//= require 'agile/list_widget.js'
//= require 'agile/list_item_widget.js'
//= require 'agile/group_select.js'
//= require 'agile/kanban_view.js'
//= require 'agile/backlog_view.js'
//= require 'agile/scrum_view.js'
//= require 'agile/kanban_model.js'
//= require 'agile/backlog_model.js'
//= require 'agile/scrum_model.js'
//= require 'agile/kanban.js'
//= require 'agile/scrum.js'
//= require 'agile/backlog.js'

//= require 'easter_eggs/fireworks'
//= require 'utils/affix.js'
//= require 'utils/easy_query.js'
//= require 'utils/easy_resources.js'
//= require 'utils/extensions_utils.js'
//= require 'utils/top_menu.js'
//= require 'utils/lazy_loader.js'
//= require 'utils/ep_extension.js'
//= require 'utils/attendance_calendar.js'
//= require 'utils/jquery_widgets.js'
//= require 'utils/responsivizer.js'
//= require 'utils/custom_fields.js'
//= require 'utils/time_log.js'

//= require 'schedule/onload.js'
//= require 'schedule/early.js'
//= require 'schedule/middle.js'
//= require 'schedule/late.js'

//= require 'easy_page'
//= require 'page_tab'
//= require 'easy_extensions_asset_hooks'

//= require 'old_api_map'

var key_count_global = null;


// more than 1000 usages in code, left in global scope
function scrollTo(scroll_element, offset) {
  var topOffset = (($(scroll_element).offset() || {}).top || 0) + (offset || 0);
  $('html, body').animate({
    scrollTop: topOffset
  }, 500);
}

function isIE() {
  return getInternetExplorerVersion() !== -1;
}

// From http://msdn.microsoft.com/en-us/library/ms537509%28v=vs.85%29.aspx
function getInternetExplorerVersion() {
  // Returns the version of Internet Explorer or a -1
  // (indicating the use of another browser).
  var rv = -1; // Return value assumes failure.
  if (navigator.appName === 'Microsoft Internet Explorer') {
    var ua = navigator.userAgent;
    var re = new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");
    if (re.exec(ua) !== null)
      rv = parseFloat(RegExp.$1);
  } else if (!!navigator.userAgent.match(/Trident.*rv[ :]*11\./)) {
    rv = 11;
  }
  return rv;
}


// used from sidebar, left in global scope
function showFlashMessage(type, message) {
  ERUI.content.find(".flash").remove();
  return $("<div/>").attr({"class": "flash"}).addClass(type).html($("<span/>").html(message)).append($("<a/>").attr({
    "href": "javascript:void(0)",
    "class": "icon-close"
  }).click(function (event) {
    $(this).closest('.flash').fadeOut(500, function () {
      $(this).remove();
    });
  })).prependTo($("#content"));
}



