   # Public: This method is called when a user clears their authentication. By
   # default, it reloads the current page.
   onLogout: (data, status, xhr) ->
-    alert("Logout result: #{status} #{data}")
-    #window.location.reload()
+    if @debug
+      alert("Logout result: #{status} #{data}")
+    else
+      window.location.reload()
 
   # Public: This method is called when a user fails to clear their
   # authentication.
   onLogoutError: (xhr, status, err) ->
     alert("Logout #{err} - #{xhr.responseText}")
+
+
+  ### INITIALIZATION ###
 
   # Public: Watches the authentication state and takes action when the user
   # logs in or logs out. This method MUST be called on every page of the

  # This should clear the currently-logged-in user email.
  logoutPath: '/logout'

  # Public: This method is called when a user successfully authenticates. By
  # default, it reloads the current page.
  onLogin: (data, status, xhr) ->
    alert("Login result: #{status} #{data}")
    #window.location.reload()

  # Public: This method is called when a user fails to authenticate.
  onLoginError: (xhr, status, err) ->

          type: 'POST'
          url: @loginPath
          data: { assertion: assertion }
          success: (data, status, xhr) => @onLogin(data, status, xhr)
          error: (xhr, status, err) => @onLoginError(xhr, status, err)
      onlogout: =>
        $.ajax
          type: 'POST'
          url: @logoutPath
          success: (data, status, xhr) => @onLogout(data, status, xhr)
          error: (xhr, status, err) => @onLogoutError(xhr, status, err)



