           $("#" + set + "-end").val ""  if $("#" + set + "-end").val() is "9999"
         else
       console.log "data"
-    @
-  
-  class PersonSingleView extends Backbone.View
+      return
+  )
+  PersonSingleView = Backbone.View.extend(
     el: "#page"
     fuzzyDateRenderer: (type, date1, date2) ->
       

          
          #evaluate whether this person has any relationships in the collection to display
          if relationships.models.length > 0
            require [ "text!../templates/view_relationships.html.tpl" ], (template) ->
              $("#relationships").html _.template(template,
                relationships: relationships.models
              )

          else
            
            # cant name the person because it is loaded syncronously.
            template = "No relationships were found."
            $("#relationships").html template

  
  class Router extends Backbone.Router
    routes:
      "": "home"
      "view/:id": "viewPerson"
      new: "editPerson"
      list: "home"
      search: "searchForm"

  router = new Router
  
  #because peopleListView is special, we need to have this outside of the init router, otherwise it doesn't work when we call a subpage directly etc.
  router.on "route:home", ->
    peopleListView = new PeopleListView()
    peopleListView.render()

  router.on "route:searchForm", ->
    searchFormView = new SearchFormView()
    $("#homepage").hide()
    searchFormView.render()

  router.on "route:viewPerson", (id) ->
    personSingleView = new PersonSingleView()
    $("#homepage").hide()
    personSingleView.render id: id

  Backbone.history.start()

    a = @serializeArray()
    $.each a, ->
      if o[@name] isnt `undefined`
        o[@name] = [o[@name]]  unless o[@name].push
        o[@name].push @value or ""
      else
        o[@name] = @value or ""
      return

    o

  $.ajaxPrefilter (options, originalOptions, jqXHR) ->
    options.url = "http://localhost/researchdb/html/liverpool/api" + options.url
    return

  Person = Backbone.Model.extend(urlRoot: "/people")
  People = Backbone.Collection.extend(
    url: "/people"
    model: Person
    parse: (response) ->
      response
  )
  Backbone.PageableCollection = PageableCollection
  PaginatedPeople = Backbone.PageableCollection.extend(
    model: Person
