         ver = element.find('.version')
         if ver.length
           urn = element.find('.app-name a').text()
-          url = "//#{urn}.herokuapp.com/g5_ops/health"
-          master_version = element.find('.master-version')
-          $.ajax url,
-            method: 'GET'
-            success: (res, status, xhr) ->
-              version = if res.version then res.version else res.health.version
-              if version == master_version
-                klass = 'current'
-              else if version > master_version
-                klass = 'ahead'
-              else if version < master_version
-                klass = 'behind'
-              ver.find('.version-value').html("<b class='#{klass}'>#{version}</b>")
-            error: (xhr, status, err) ->
-              ver.find('.version-value').html("<b class='error'>not found</i>")
-
+          master = ver.find('.master-version').text()
+          window.ajaxVersion(urn, master, ver)

        $(title).addClass('show')
        $(title).next('.app-list').addClass('show')

$(document).ready ->
  window.toggleAppsGroups()
  if $('.app').hasClass('orgs')
    window.orgsController = new OrgsController
  else


class AppsController
  constructor: ->
    window.toggleAppsGroups()
    @updateAppsVersions()

  updateAppsVersions: ->
    $(".app-title").each (idx, elem) ->
      master = $(elem).find('.version-value')
      if master.length
        master = master.text()
        ul = $(elem).next('ul')
        ul.find('li').each (idx2, elem2) ->
          element = $(elem2)
          urn = element.find('.app-name a').text()
          ver = element.find('.version')
          window.ajaxVersion(urn, master, ver)


class OrgsController
  constructor: ->
    window.toggleAppsGroups()
    @updateOrgsVersions()

  updateOrgsVersions: ->
