class @Mercury.PageEditor
# options
# saveStyle: 'form', or 'json' (defaults to json)
# visible: boolean, if the interface should start visible or not (defaults to true)
constructor: (@saveUrl = null, @options = {}) ->
throw "Mercury.PageEditor is unsupported in this client. Supported browsers are chrome 10+, firefix 4+, and safari 5+." unless Mercury.supported
throw "Mercury.PageEditor can only be instantiated once." if window.mercuryInstance
@options.visible = true unless @options.visible == false
@visible = @options.visible
window.mercuryInstance = @
@regions = []
@initializeInterface()
Mercury.csrfToken = token if token = jQuery(Mercury.config.csrfSelector).attr('content')
initializeInterface: ->
@focusableElement = jQuery('', {type: 'text', style: 'position:absolute;opacity:0'}).appendTo(@options.appendTo ? 'body')
@iframe = jQuery('