Moved javascript to external file for use in admin and site log and doc management