-window.apiCall = (type, url, data) ->
+@apiCall = (type, url, data) ->
   $.ajax {url: url, type: type, data: data, cache: false}
   .fail (jqXHR, text) ->
     $.notify "API is offline. :(", "error"
 
-window.redirectIfNotLoggedIn = ->
+@redirectIfNotLoggedIn = ->
   apiCall "GET", "/api/user/status", {}
   .done (data) ->
     switch data["status"]

        if not data.data["logged_in"]
          window.location.href = "/login"

window.redirectIfLoggedIn = ->
  apiCall "GET", "/api/user/status", {}
  .done (data) ->
    switch data["status"]

      style = "success"
  return style

@apiNotify = (data) ->
  style = getStyle data
  $.notify data.message, style

