title: Callback code seems to run before callback is actually called
body: <p>This sounds like a weird title and probably not stated too well.  But here's the issue.</p>
  
  <p>I've got this method being called:</p>
  
  <pre><code>function BindFacebookAlbumAndPhotoData() 
  {
      GetAllFacebookAlbums(userID, accessToken, function(aAlbums) 
      {
          if (aAlbums === null || aAlbums === undefined) 
          {
              // TODO: Need to handle this
              return;
          }
  
          var defaultAlbumID = aAlbums[0].id;
  
          BindFacebookAlbumDropdownList(aAlbums, defaultAlbumID);
  
          BindFacebookThumbnails(userID, accessToken, defaultAlbumID, photosContainerDivID);
  
          SetSelectDefaultOption(defaultAlbumID);
      });
  }
  </code></pre>
  
  <p>So here's the GetAllFacebookAlbums Method:</p>
  
  <pre><code>function GetAllFacebookAlbums(userID, accessToken, callbackFunction)
  {
      var aAlbums = [];
      var uri = "/" + userID + "/albums?access_token=" + accessToken;
  
      // this is an async call so code after this will fire at the same time
      FB.api(uri, function(response) 
      {
          // check for a valid response
          if (!response || response.error) 
          {
              callbackFunction(albums);
          }
  
          for (var i = 0, l = response.data.length; i &lt; l; i++) 
          {
              //do whatever
          }
      });
  
      // wait for the FB.api call to run a bit before calling code below
      window.setTimeout(callbackFunction(aAlbums), 5000);
  }
  </code></pre>
  
  <p>What's happening is this line is being called before the setTimeout it seems:</p>
  
  <pre><code>var defaultAlbumID = aAlbums[0].id;
  </code></pre>
  
  <p>the whole reason I put that timeout in there is so I can wait for the FB.api call to finish.  Then call the callback after I know I have data.  So how in the world are those lines in my callback being called when I have definitely not seen a 5 second delay before that callback is called?</p>