take show_document's js code into a separate js file