uiMargin * 2) + 'px',
      height: (bbox.b - bbox.t - uiMargin * 2) + 'px'
    });

    g_editorState.cropperBBox = bbox;
  }

  function showCropper() {
    $editor.hide();
    $cropper.show();
    g_editorState.cropping = true;

    $cropperimage.attr('src', g_editorState.imageUrl + '?cachebust=' + Math.random());
  }

  function hideCropper() {
    $cropper.hide();
    $editor.show();
    g_editorState.cropping = false;
  }

  window.setupEditor = setupEditor;
  window.setupCropper = setupCropper;
  win