 
 window.onload = ->
   drawTrack = (track) ->
-    alert track.name
+    link = copyright.firstChild
+    link.text = track.name + " - " + track.artist["#text"]
+    link.href = track.url
+    console.log track
+
+  drawImage = (response) ->
+    document.body.style.backgroundImage = "url(#{response.imageUrl})"
+    link = copyright.firstChild
+    link.href = response.copyrightLink
+    link.text = response.copyright
+
+    copyright.onmouseenter = -> document.body.classList.add "clean"
+    copyright.onmouseleave = -> document.body.classList.remove "clean"
 
   aberigle.api.lastfm.getNowPlaying "jayle23", (track) ->
     if track? then drawTrack track
-    else aberigle.api.image.getImage (response) ->
-      document.body.style.backgroundImage = "url(#{response.imageUrl})"
-      link = copyright.firstChild
-      link.href = response.copyrightLink
-      link.text = response.copyright
-
-      copyright.onmouseenter = -> document.body.classList.add "clean"
-      copyright.onmouseleave = -> document.body.classList.remove "clean"
+    else aberigle.api.image.getImage drawImage


    @_get url, (response) ->
      response = JSON.parse(response.response).recenttracks
      if Object::toString.call(response.track) is "[object Array]"
        callback? response.track[0]
      else callback?()


console.log "Hay there, you can find me @aberigle"

window.isArray = (object) -> Object::toString.call(object) is "[object Array]"

class API

