var HistoryManager=(function(){var A=new Class({initialize:function(){this._currentLocation=this._getHash();var C=this;if(window.ie){this.addState=this._addStateIE;this._iframe=new Element("iframe",{src:"javascript:'<html></html>'",styles:{position:"absolute",top:"-1000px"}}).inject(document.body).contentWindow;$justForIE=function(E){C._getHash=function(){return E};C._monitorDefault.call(C);location.hash=E};function D(){if(C._iframe&&C._iframe.document&&C._iframe.document.body){if(!C._iframe.document.body.innerHTML){C.addState(C._currentLocation,true)}}else{setTimeout(D,50)}}D()}else{if(window.webkit419){this._form=new Element("form",{method:"get"}).inject(document.body);this._historyCounter=history.length;this._stateHistory=[];this._stateHistory[history.length]=this._getHash();this.addState=this._addStateSafari;this._monitorSafari.periodical(250,this)}else{if(window.opera){this.addState=this._addStateDefault;$justForOpera=function(){C._monitorDefault.call(C)};new Element("img",{src:"javascript:location.href='javascript:$justForOpera();';",style:"position: absolute; top: -1000px;"}).inject(document.body)}else{this.addState=this._addStateDefault;this._monitorDefault.periodical(250,this)}}}},getCurrentLocation:function(){return this._currentLocation},_getHash:function(){return location.href.split("#")[1]||""},_addStateIE:function(D,C){if(this._currentLocation==D&&!C){return }this._currentLocation=D;this._iframe.document.write("<html><body onload=\"top.$justForIE('",D,"');\">Loaded</body></html>");this._iframe.document.close()},_addStateSafari:function(C){if(this._currentLocation==C){return }this._form.setProperty("action","#"+C).submit();this._currentLocation=C;this._stateHistory[history.length]=this._getHash();this._historyCounter=history.length},_monitorSafari:function(){if(history.length!=this._historyCounter){this._historyCounter=history.length;this._currentLocation=this._stateHistory[history.length];this.fireEvent("onHistoryChange",[this._stateHistory[history.length]])}},_addStateDefault:function(C){if(this._currentLocation==C){return }location.hash="#"+C;this._currentLocation=C},_monitorDefault:function(){var C=this._getHash();if(C!=this._currentLocation){this._currentLocation=C;this.fireEvent("onHistoryChange",[C])}}});A.implement(new Events);var B;return function(){return B?B:B=new A()}})();
