I ended up turning this into one function, and it seems to work as far as I have tested.
All I had to do was do this for the first part of the folder bind function: bindToFolder = function(specific){ $(specific).find('a').bind('click', function(evt){ // do stuff ... // go to specified tree }); }); # and then call my function starting with the initial tree bindToFolder('.myTree');