window.sparouter=(function(){function RootingError(message){this.message=message;this.toString=function(){"The following error occured: "+message;};} function Sparouter(newurl,oldurl){this.newurl=newurl;this.oldurl=oldurl;this.pagesListeners={};} Sparouter.prototype.changePage=function(page){this.allPagesInvisible();this.showPage(page);};Sparouter.prototype.showPage=function(page){this.page(page).style.display="block";};Sparouter.prototype.hidePage=function(page){this.page(page).style.display="none";};Sparouter.prototype.page=function(page){return window.document.querySelector("div[data-page="+page+"]");};Sparouter.prototype.allPagesInvisible=function(){var datapages=window.document.querySelectorAll("div[data-page]");for(var i=0;i0){var hash=pages[0].getAttribute("data-page");window.location.replace("#"+hash);} else throw new RootingError("No div[data-page] elements exist in the HTML");} function handleLinks(){var aLinks=window.document.querySelectorAll("a[href^='#']");for(var i=0;i