Don't attach js functions on all pages, just call from those that need to.