(function(){var G=null;var D=location.hash;var C="#_";var A=[];var B=0;var I;window.ui={showPage:function(M,L){if(M){var N=G;G=M;if(N){setTimeout(E,0,N,M,L)}else{J(M,N)}}},showPageById:function(M){var O=F(M);if(O){var N=A.indexOf(M);var L=N!=-1;if(L){A.splice(N,A.length)}ui.showPage(O,L)}},getSelectedPage:function(){for(var L=document.body.firstChild;L;L=L.nextSibling){if(L.nodeType==1&&L.getAttribute("selected")=="true"){return L}}}};addEventListener("load",function(L){var M=ui.getSelectedPage();if(M){ui.showPage(M)}setTimeout(H,0);I=setInterval(H,300)},false);addEventListener("click",function(M){var L=K(M.target,"a");if(L){if(L.href&&L.hash&&L.hash!="#"){L.setAttribute("selected","true");ui.showPage(F(L.hash.substr(1)));L.removeAttribute("selected")}else{if(L==F("backButton")){history.back()}else{return }}M.preventDefault()}},true);function H(){if(location.hash!=D){var L=location.hash.substr(C.length);ui.showPageById(L)}}function J(N,O){if(!N.id){N.id="__"+(++B)+"__"}location.href=D=C+N.id;A.push(N.id);var M=F("pageTitle");if(N.title){M.innerHTML=N.title}var L=F("backButton");if(L){L.style.display="inline"}}function E(O,N,M){N.style.left="100%";N.setAttribute("selected","true");scrollTo(0,1);clearInterval(I);L();function L(){O.style.left=(M?100:-100)+"%";N.style.left="0%";O.removeAttribute("selected");I=setInterval(H,300);setTimeout(J,0,N,O)}}function K(M,L){while(M&&(M.nodeType!=1||M.localName.toLowerCase()!=L)){M=M.parentNode}return M}function F(L){return document.getElementById(L)}})();
