fixes #26; and cleaned up refdoc.js as per wkeese comments. More refactoring needed (code in 2 places checking for an existing pane)