   $('.download-btn').on 'click', (e) ->
     url = buildUrl screenWidth, screenHeight, foregroundColor, backgroundColor, compoundName
     window.open url
-    
+
   refreshSmilesPreview() # Initial update.

    
  $('.picker-fg').on 'change', (e) ->
    foregroundColor = $(e.target).val().substring(1)
    refreshPreview()
    
  $('.picker-bg').on 'change', (e) ->
    backgroundColor = $(e.target).val().substring(1)
    refreshPreview()
    
  # Compound name update button should refresh the preview.
    
  $('.update-btn').on 'click', (e) ->
    errorRows.hide()
    checkMoleculeName getCompoundName(), refreshPreview, failPreview

  $('.update-smiles-btn').on 'click', (e) ->
    errorRows.hide()
    checkSmiles getCompoundSmiles(), refreshSmilesPreview, failPreviewSmiles
   

$(document).ready ->
  screenWidth = window.screen.availWidth
  screenHeight = window.screen.availHeight

  smilesMode = true

  foregroundColor = 'ffffff'
  backgroundColor = '000000'
