(function(a,b){"use strict";varc=a.document,d=a.setTimeout||d,e=a.clearTimeout||e,f=a.setInterval||f,g=a.History=a.History||{};if(typeofg.initHtml4!="undefined")thrownewError("History.js HTML4 Support has already been loaded...");g.initHtml4=function(){if(typeofg.initHtml4.initialized!="undefined")return!1;g.initHtml4.initialized=!0,g.enabled=!0,g.savedHashes=[],g.isLastHash=function(a){varb=g.getHashByIndex(),c;returnc=a===b,c},g.saveHash=function(a){returng.isLastHash(a)?!1:(g.savedHashes.push(a),!0)},g.getHashByIndex=function(a){varb=null;returntypeofa=="undefined"?b=g.savedHashes[g.savedHashes.length-1]:a<0?b=g.savedHashes[g.savedHashes.length+a]:b=g.savedHashes[a],b},g.discardedHashes={},g.discardedStates={},g.discardState=function(a,b,c){vard=g.getHashByState(a),e;returne={discardedState:a,backState:c,forwardState:b},g.discardedStates[d]=e,!0},g.discardHash=function(a,b,c){vard={discardedHash:a,backState:c,forwardState:b};returng.discardedHashes[a]=d,!0},g.discardedState=function(a){varb=g.getHashByState(a),c;returnc=g.discardedStates[b]||!1,c},g.discardedHash=function(a){varb=g.discardedHashes[a]||!1;returnb},g.recycleState=function(a){varb=g.getHashByState(a);returng.discardedState(a)&&deleteg.discardedStates[b],!0},g.emulated.hashChange&&(g.hashChangeInit=function(){g.checkerFunction=null;varb="",d,e,h,i;returng.isInternetExplorer()?(d="historyjs-iframe",e=c.createElement("iframe"),e.setAttribute("id",d),e.style.display="none",c.body.appendChild(e),e.contentWindow.document.open(),e.contentWindow.document.close(),h="",i=!1,g.checkerFunction=function(){if(i)return!1;i=!0;varc=g.getHash()||"",d=g.unescapeHash(e.contentWindow.document.location.hash)||"";returnc!==b?(b=c,d!==c&&(h=d=c,e.contentWindow.document.open(),e.contentWindow.document.close(),e.contentWindow.document.location.hash=g.escapeHash(c)),g.Adapter.trigger(a,"hashchange")):d!==h&&(h=d,g.setHash(d,!1)),i=!1,!0}):g.checkerFunction=function(){varc=g.getHash();returnc!==b&&(b=c,g.Adapter.trigger(a,"hashchange")),!0},g.intervalList.push(f(g.checkerFunction,g.options.hashChangeInterval)),!0},g.Adapter.onDomLoad(g.hashChangeInit)),g.emulated.pushState&&(g.onHashChange=function(b){vard=b&&b.newURL||c.location.href,e=g.getHashByUrl(d),f=null,h=null,i=null,j;returng.isLastHash(e)?(g.busy(!1),!1):(g.doubleCheckComplete(),g.saveHash(e),e&&g.isTraditionalAnchor(e)?(g.Adapter.trigger(a,"anchorchange"),g.busy(!1),!1):(f=g.extractState(g.getFullUrl(e||c.location.href,!1),!0),g.isLastSavedState(f)?(g.busy(!1),!1):(h=g.getHashByState(f),j=g.discardedState(f),j?(g.getHashByIndex(-2)===g.getHashByState(j.forwardState)?g.back(!1):g.forward(!1),!1):(g.pushState(f.data,f.title,f.url,!1),!0))))},g.Adapter.bind(a,"hashchange",g.onHashChange),g.pushState=function(b,d,e,f){if(g.getHashByUrl(e))thrownewError("History.js does not support states with fragement-identifiers (hashes/anchors).");if(f!==!1&&g.busy())returng.pushQueue({scope:g,callback:g.pushState,args:arguments,queue:f}),!1;g.busy(!0);varh=g.createStateObject(b,d,e),i=g.getHashByState(h),j=g.getState(!1),k=g.getHashByState(j),l=g.getHash();returng.storeState(h),g.expectedStateId=h.id,g.recycleState(h),g.setTitle(h),i===k?(g.busy(!1),!1):i!==l&&i!==g.getShortUrl(c.location.href)?(g.setHash(i,!1),!1):(g.saveState(h),g.Adapter.trigger(a,"statechange"),g.busy(!1),!0)},g.replaceState=function(a,b,c,d){if(g.getHashByUrl(c))thrownewError("History.js does not support states with fragement-identifiers (hashes/anchors).");if(d!==!1&&g.busy())returng.pushQueue({scope:g,callback:g.replaceState,args:arguments,queue:d}),!1;g.busy(!0);vare=g.createStateObject(a,b,c),f=g.getState(!1),h=g.getStateByIndex(-2);returng.discardState(f,e,h),g.pushState(e.data,e.title,e.url,!1),!0}),g.emulated.pushState&&g.getHash()&&!g.emulated.hashChange&&g.Adapter.onDomLoad(function(){g.Adapter.trigger(a,"hashchange")})},typeofg.init!="undefined"&&g.init()})(window)