added global error handler & active class js

error handling not finished. js func needs to be moved to js file and
out of layout