           output = "#{exception}"
         editors[index + 1].setValue output
       , lastCompilationElapsedTime
+
+
+# Handle the code example buttons
+$('button').click ->
+  run = $(@).data 'run'
+  index = $("##{$(@).data('example')}-js").data 'index'
+  js = editors[index].getValue()
+  js = "#{js}\nalert(#{unescape run});" unless run is yes
+  eval js

    readOnly: if mode is 'coffeescript' then no else 'nocursor'
    viewportMargin: Infinity

  if mode is 'coffeescript'
    pending = null
    editor.on 'change', (instance, change) ->

editors = []
lastCompilationElapsedTime = 200
$('textarea').each (index) ->
  $(@).data 'index', index
  mode = if $(@).hasClass('javascript-output') then 'javascript' else 'coffeescript'

  editors[index] = editor = CodeMirror.fromTextArea @,
