function fileTreeCallback(file) { if (typeof(window.opener.fileTreeCallback) != 'undefined' ) { window.opener.fileTreeCallback(file); } else { window.open(WWW_URL+category+'/'+file.replace(WWW_PATH,'')); } } function initFileTree() { $(document).ready(function(){ $('#filetree').fileTree( { root: WWW_PATH, script:'filetree', expandSpeed: 100, collapseSpeed: 100 }, fileTreeCallback ); }); }