 
   autoOffClicked: () ->
     console.log "Cancel button clicked"
-    #Tp.devices.projector.trigger "autoOffCancel"
     Tp.projectorPane.trigger "autoOffCancel"


  autoOff: (state) ->
    if state == "on"
      console.log "Timer turning on"
      shutOff = ->
        Tp.devices.projector.state_set 'power', false
      warning = ->
        $('#auto-off').show()
        @offTimer = setTimeout shutOff, 5000
      
      #@timer = setTimeout callback, 10800000 # Three hour timer
      @warningTimer = setTimeout warning, 10000
    else if state == "off"
      if @warningTimer then clearTimeout(@warningTimer)
      if @offTimer then clearTimeout(@offTimer)
      $('#auto-off').hide()

  autoOffCancel: () =>
    console.log "This thing should work.. Cancelling shutoff"
    warningTimer = Tp.projectorPane.warningTimer
    offTimeer = Tp.projectorPane.offTimer
    if warningTimer then clearTimeout(Tp.projectorPane.warningTimer)
    if offTimer then clearTimeout(Tp.projectorPane.offTimer)
    $('#auto-off').hide()
    Tp.projectorPane.autoOff("on")


    #Tp.devices.projector.bind "autoOffCancel", @autoOffCancel
    this.bind "autoOffCancel", @autoOffCancel

    Tp.room.offTimer = null
    Tp.room.warningTimer = null

  render: () ->
    ($.tmpl "projector-pane-template", {
