

  function hideEditor() {
    g_editorState = null;
    $editor.hide();
    $('#calendar').show();
  }

  function showEditor(args) {
    g_editorState = args;
    g_editorState.crop = [0, 0, 1, 1];

    $('#editor input, #editor textarea').val('');

    if (args.action == 'edit') {
      if (!args.id) {
        g_editorState = null;
        alert('no ID for artwork, can\'t edit.');
        return;
      }
      var clonedArtwork = JSON.parse(JSON.stringify(args.artwork));
      $title.val(clonedArtwork.t