 class GraphView
 
   setUp: =>
+    @graphLoaded = false
     @updateWindowSize()
     $(window).resize(@updateWindowSize)
     @currentGraph = 0


  preloadImage: (url) ->
    @graph = new Image()
    @graph.src = url

  preloadIframe: (url) ->

      scrolling: "no",
      frameborder: "no"
    })
    @graphLoaded = true

  displayGraph: =>
    if not @graphLoaded
      # Wait for our image to load
      setTimeout(@displayGraph, 1000)
      return
    graphConf = @config.graphs[@currentGraph]
    $('#container').html(@graph)
    $('h1#title').html(graphConf.title)
    @currentGraph = (@currentGraph + 1) % @config.graphs.length
    @graphLoaded = false
    setTimeout(@displayGraph, @config.settings.dwellTime)
    @preloadGraph(@config.graphs[@currentGraph])

