     selectable: true
     selectHelper: true
     select: (start, end, allDay) ->
-      $('#template_form').html(templateSlotForm)
-      
-      $('#template_slot_day').val(start.getDayName())
-      $('#from_time_hour').val(start.getHours())
-      $('#from_time_minute').val(start.getMinutes())
-      $('#to_time_hour').val(end.getHours())
-      $('#to_time_minute').val(end.getMinutes())
+      FormHandler.showForm(null, start, end)
       
       $('#template_form form').on 'submit', (e) ->
         e.preventDefault()

            tableSlotCalendar.fullCalendar "renderEvent",
              title: data.id.toString()
              start: start
              end: end
              allDay: false
            , true # make the event "stick"

  d = ['Sunday','Monday','Tuesday','Wednesday', 'Thursday','Friday','Saturday']
  d[@getDay()]

FormHandler = 
  showForm: (id, start, end, recurrence=1)->
      $('#template_form').html(templateSlotForm)
      
      $('#template_slot_day').val(start.getDayName())
      $('#from_time_hour').val(start.getHours())
      $('#from_time_minute').val(start.getMinutes())
      $('#to_time_hour').val(end.getHours())
      $('#to_time_minute').val(end.getMinutes())


$(document).ready ->
  date = new Date()
