code refactoring: javascript of static pages