       0
 
     return
-
+  # Invoked when user clicks on a table header of search results
+  # Calls appropriate sort method 
+  # Calls method to update icons representing sort direction
+  # type [String] (name,brating)
+  # vm [ViewModel]
+  # event [jQueryEvent]
   self.handleSort = (type,vm,event) ->
     #default to descending sort
-    #unless clicked on the table header twice
+    #unless already sorted by the same type
     sortDirection = if type is currentSort then -sortDirection else -1
     currentSort = type
     self.updateTableHeaders(type, event)


    return

  self.getYQLurl = (str) ->
    q = "select * from xml where url="
    url = "'" + str + "'"
    "http://query.yahooapis.com/v1/public/yql?q=" + encodeURIComponent(q + url) + "&format=json&callback=?"

  self.getGameDetails = (id) ->
    if Modernizr.sessionstorage
      gdata = eval("(" + sessionStorage["bg" + id] + ")")

#Code Convetions

#---------------------------------------------------------------------------------------------------
#https://github.com/polarmobile/coffeescript-style-guide

#---------------------------------------------------------------------------------------------------

#Use spaces only, with 2 spaces per indentation level. Never mix tabs and spaces.

#---------------------------------------------------------------------------------------------------

#Always surround these binary operators with a single space on either side
# assignment: =
# augmented assignment: +=, -=, etc.
# comparisons: ==, <, >, <=, >=, unless, etc.
# arithmetic operators: +, -, *, /, etc.

#---------------------------------------------------------------------------------------------------

# Use camelCase (with a leading lowercase character) to name all variables, methods, and object properties.
# Use CamelCase (with a leading uppercase character) to name all classes.

#---------------------------------------------------------------------------------------------------

# When declaring a function that takes arguments, always use a single space after the closing parenthesis of the arguments list:
# foo = (arg1, arg2) -> # Yes
# foo = (arg1, arg2)-> # No

#---------------------------------------------------------------------------------------------------

# Take advantage of comprehensions whenever possible:

#   # Yes
#   result = (item.name for item in array)

#   # No
#   results = []
#   for item in array
#     results.push item.name

# To filter:

# result = (item for item in array when item.name is "test")

# To iterate over the keys and values of objects:

# object = one: 1, two: 2
# alert("#{key} = #{value}") for key, value of object

#---------------------------------------------------------------------------------------------------

# Annotation types:

#     TODO: describe missing functionality that should be added at a later date
#     FIXME: describe broken code that must be fixed
#     OPTIMIZE: describe code that is inefficient and may become a bottleneck
#     HACK: describe the use of a questionable (or ingenious) coding practice
#     REVIEW: describe code that should be reviewed to confirm implementation

#---------------------------------------------------------------------------------------------------

$ ->
  $(document).foundation()
