Optimized javascript for flyout pathbar.