     cloud.animate {left: -250}, 60000, 'linear', ->
         cloud.remove()
 
+performYTSearch = (s, cb) ->
+    $.ajax
+      dataType: 'jsonp'
+      type: 'GET'
+      url: "http://gdata.youtube.com/feeds/api/videos?q=#{ encodeURIComponent(s) }" +
+           "&format=5&v=2&alt=jsonc" + # Force embeddable vids (format=5)
+           "&max-results=1"
+      success: (responseData, textStatus, XMLHttpRequest) =>
+          if videoId = responseData?.data?.items?[0].id
+              cb (videoId)
+
 startAnimation = ->
     createCloud()
     window.setInterval ->

        frisbee.animate {left: percentOfWidth(-25), bottom: percentOfHeight(-25)}, 1250, 'easeInOutQuad', ->
                cb()

    if oldFrisbee.hasClass('frisbeeContent')
        oldFrisbee.fadeOut animateFrisbee
    else
        oldFrisbee.animate left: -300, 1000, 'easeInOutQuad', animateFrisbee

        , 200

$ ->
    search = window.location.search
    if search
        YT_SEARCH = ///youtube=([^&]*)///
        result = YT_SEARCH.exec search
        s = result[1]
        s = s.replace(',', ' ')

        YT_TIME = ///time=([^&]*)///
        result = YT_TIME.exec search
        time = result[1]

        console.log 'hey'

        performYTSearch s, (videoId) ->
            throwFrisbee ->
                handleData type: 'youtube', content: videoId, time: time
    else
        startAnimation()





