title: How do I detect if a javascript constructor already been run?
body: <p>I'm using the jquery-tools tabs and carousel in a page I'm working on. The carousel is embedded within a tab, and the tab is loaded in a beforeClick callback. </p>
  
  <p>Normally, the carousel is initialized in the document ready function like so:</p>
  
  <pre><code>$(function() { 
          // initialize scrollable 
          $("div.scrollable").scrollable({ 
                  size: 3, 
                  clickable: true, 
                  loop: false 
              }).mousewheel(); 
  </code></pre>
  
  <p>This doesn't work when the carousel is loaded via beforeClick, because it when the DOM is ready, this tab hasn't been loaded yet.</p>
  
  <pre><code>        $("ul.tabs").tabs("div.panes &gt; div", {
            initialIndex: 0,
               onBeforeClick: function(event, i) {
                      // get the pane to be opened
                  var pane = this.getPanes().eq(i);
  
                  var src = this.getTabs().eq(i).attr("href");
                  var langPattern = "/^" + getLang() + '/';
                  var forceReload = false;
                  if (src.match(langPattern) == null)
                  {
                    src = getLang() + "/" + src;
                    forceReload = true;
                  }
                  if (pane.is(":empty") || forceReload) {
                      // load it with a page specified in the tab's href attribute
                      pane.load(src);
                      // initialize scrollable - ONLY SHOULD BE DONE ONCE
                  $("div.scrollable").scrollable({ 
                      size: 3, 
                      clickable: true, 
                      loop: false 
                  }).mousewheel(); 
                  }
              }
        }).history();;
  </code></pre>
  
  <p>My question is a two-parter:</p>
  
  <p>First, is there an event I can add a handler to to initialize the scrollable when it is first loaded?
  Second, if there isn't, is there a way I can find out if the scrollable has been constructed yet?</p>
  
  <p>The idea behind this code is to load localized html fragments based on the user's language selection. This is for a catalog on a CD, not online.</p>