+ page.pushstate = page.popstate = function(path) {
+ $('#sidebar_content').load(path, page.load);
+ };
+
+ page.load = function() {
+ map.addObject(OSM.mapParams().object, {zoom: true});
+ };
+
+ page.unload = function() {
+ map.removeObject();
+ };
+
+ return page;
+ };
+
+ var router = OSM.Router({
+ "/": OSM.Index(map),
+ "/export": OSM.Export(map),
+ "/browse/changesets": OSM.ChangesetList(map),
+ "/browse/:type/:id(/history)": OSM.Browse(map)
+ });
+
+ $(document).on("click", "a", function(e) {
+ if (router(this.pathname + this.search + this.hash)) e.preventDefault();
+ });
+});