split "pagebeforechange" into service and routing parts
split map and routing code into routing.coffee