     @$(".CodeMirror").each (index, element) ->
       element.CodeMirror.save() if element.CodeMirror.save
     @answers = @$("[id^=input_#{@element_id.replace(/problem_/, '')}_]").serialize()
+
+  inputtypeSetupMethods:
+    javascriptinput: (element) =>
+
+      data = $(element).find(".javascriptinput_data")
+
+      params        = JSON.parse(data.attr("data-params"))
+      submission    = JSON.parse(data.attr("data-submission"))
+      evaluation    = JSON.parse(data.attr("data-evaluation"))
+      problemState  = JSON.parse(data.attr("data-problem_state"))
+      displayClass  = eval(data.attr("data-display_class"))
+
+      container = $(element).find(".javascriptinput_container")
+      submissionField = $(element).find(".javascriptinput_input")
+
+      display = new displayClass(problemState, submission, evaluation, container, submissionField, params)
+      display.render()

class @Problem
  constructor: (element) ->
    @el = $(element).find('.problems-wrapper')
    @id = @el.data('problem-id')

        @render(response.html)
        @updateProgress response

  # TODO this needs modification to deal with javascript responses; perhaps we
  # need something where responsetypes can define their own behavior when show
  # is called.
  show: =>
    if !@el.hasClass 'showed'
      Logger.log 'problem_show', problem: @id
