window.dhtmlHistory={isIE:false,isOpera:false,isSafari:false,isKonquerer:false,isGecko:false,isSupported:false,create:function(a){var e=this;this._blankFile="blank.html";if(a.blankFile){this._blankFile=a.blankFile}var h=navigator.userAgent.toLowerCase();var g=navigator.platform.toLowerCase();var d=navigator.vendor||"";if(d==="KDE"){this.isKonqueror=true;this.isSupported=false}else{if(typeof window.opera!=="undefined"){this.isOpera=true;this.isSupported=true}else{if(typeof document.all!=="undefined"){this.isIE=true;this.isSupported=true}else{if(d.indexOf("Apple Computer, Inc.")>-1){this.isSafari=true;this.isSupported=false}else{if(h.indexOf("gecko")!=-1){this.isGecko=true;this.isSupported=true}}}}}window.historyStorage.setup(a);if(this.isSafari){this.createSafari()}else{if(this.isOpera){this.createOpera()}}var f=this.getCurrentLocation();this.currentLocation=f;if(this.isIE){this.createIE(f)}var b=function(){e.firstLoad=null};this.addEventListener(window,"unload",b);if(this.isIE){this.ignoreLocationChange=true}else{if(!historyStorage.hasKey(this.PAGELOADEDSTRING)){this.ignoreLocationChange=true;this.firstLoad=true;historyStorage.put(this.PAGELOADEDSTRING,true)}else{this.ignoreLocationChange=false;this.fireOnNewListener=true}}var c=function(){e.checkLocation()};setInterval(c,100)},initialize:function(){if(this.isIE){if(!historyStorage.hasKey(this.PAGELOADEDSTRING)){this.fireOnNewListener=false;this.firstLoad=true;historyStorage.put(this.PAGELOADEDSTRING,true)}else{this.fireOnNewListener=true;this.firstLoad=false}}},addListener:function(a){this.listener=a;if(this.fireOnNewListener){this.fireHistoryEvent(this.currentLocation);this.fireOnNewListener=false}},addEventListener:function(a,b,c){if(a.addEventListener){a.addEventListener(b,c,false)}else{if(a.attachEvent){a.attachEvent("on"+b,function(){c(window.event)})}}},add:function(d,a){if(this.isSafari){d=this.removeHash(d);historyStorage.put(d,a);this.currentLocation=d;window.location.hash=d;this.putSafariState(d)}else{var b=this;var c=function(){if(b.currentWaitTime>0){b.currentWaitTime=b.currentWaitTime-b.waitTime}d=b.removeHash(d);if(document.getElementById(d)&&b.debugMode){var f="Exception: History locations can not have the same value as _any_ IDs that might be in the document, due to a bug in IE; please ask the developer to choose a history location that does not match any HTML IDs in this document. The following ID is already taken and cannot be a location: "+d;throw new Error(f)}historyStorage.put(d,a);b.ignoreLocationChange=true;b.ieAtomicLocationChange=true;b.currentLocation=d;window.location.hash=d;if(b.isIE){b.iframe.src=b._blankFile+"?"+d}b.ieAtomicLocationChange=false};window.setTimeout(c,this.currentWaitTime);this.currentWaitTime=this.currentWaitTime+this.waitTime}},isFirstLoad:function(){return this.firstLoad},getVersion:function(){return"0.6"},getCurrentLocation:function(){var a=(this.isSafari?this.getSafariState():this.getCurrentHash());return a},getCurrentHash:function(){var a=window.location.href;var b=a.indexOf("#");return(b>=0?a.substr(b+1):"")},PAGELOADEDSTRING:"DhtmlHistory_pageLoaded",listener:null,waitTime:200,currentWaitTime:0,currentLocation:null,iframe:null,safariHistoryStartPoint:null,safariStack:null,safariLength:null,ignoreLocationChange:null,fireOnNewListener:null,firstLoad:null,ieAtomicLocationChange:null,createIE:function(a){this.waitTime=400;var b=(historyStorage.debugMode?"width: 800px;height:80px;border:1px solid black;":historyStorage.hideStyles);var c="rshHistoryFrame";var d='<iframe frameborder="0" id="'+c+'" style="'+b+'" src="'+this._blankFile+"?"+a+'"></iframe>';document.write(d);this.iframe=document.getElementById(c)},createOpera:function(){this.waitTime=400;var a='<img src="javascript:location.href=\'javascript:dhtmlHistory.checkLocation();\';" style="'+historyStorage.hideStyles+'" />';document.write(a)},createSafari:function(){var d="rshSafariForm";var c="rshSafariStack";var a="rshSafariLength";var b=historyStorage.debugMode?historyStorage.showStyles:historyStorage.hideStyles;var f=(historyStorage.debugMode?"width:800px;height:20px;border:1px solid black;margin:0;padding:0;":historyStorage.hideStyles);var e='<form id="'+d+'" style="'+b+'"><input type="text" style="'+f+'" id="'+c+'" value="[]"/><input type="text" style="'+f+'" id="'+a+'" value=""/></form>';document.write(e);this.safariStack=document.getElementById(c);this.safariLength=document.getElementById(a);if(!historyStorage.hasKey(this.PAGELOADEDSTRING)){this.safariHistoryStartPoint=history.length;this.safariLength.value=this.safariHistoryStartPoint}else{this.safariHistoryStartPoint=this.safariLength.value}},getSafariStack:function(){var a=this.safariStack.value;return historyStorage.fromJSON(a)},getSafariState:function(){var b=this.getSafariStack();var a=b[history.length-this.safariHistoryStartPoint-1];return a},putSafariState:function(b){var a=this.getSafariStack();a[history.length-this.safariHistoryStartPoint]=b;this.safariStack.value=historyStorage.toJSON(a)},fireHistoryEvent:function(b){var a=historyStorage.get(b);this.listener.call(null,b,a)},checkLocation:function(){if(!this.isIE&&this.ignoreLocationChange){this.ignoreLocationChange=false;return}if(!this.isIE&&this.ieAtomicLocationChange){return}var a=this.getCurrentLocation();if(a==this.currentLocation){return}this.ieAtomicLocationChange=true;if(this.isIE&&this.getIframeHash()!=a){this.iframe.src="blank.html?"+a}else{if(this.isIE){return}}this.currentLocation=a;this.ieAtomicLocationChange=false;this.fireHistoryEvent(a)},getIframeHash:function(){var a=this.iframe.contentWindow.document;var b=String(a.location.search);if(b.length==1&&b.charAt(0)=="?"){b=""}else{if(b.length>=2&&b.charAt(0)=="?"){b=b.substring(1)}}return b},removeHash:function(b){var a;if(b===null||b===undefined){a=null}else{if(b===""){a=""}else{if(b.length==1&&b.charAt(0)=="#"){a=""}else{if(b.length>1&&b.charAt(0)=="#"){a=b.substring(1)}else{a=b}}}}return a},iframeLoaded:function(b){if(this.ignoreLocationChange){this.ignoreLocationChange=false;return}var a=String(b.search);if(a.length==1&&a.charAt(0)=="?"){a=""}else{if(a.length>=2&&a.charAt(0)=="?"){a=a.substring(1)}}window.location.hash=a;this.fireHistoryEvent(a)}};window.historyStorage={setup:function(e){if(typeof e!=="undefined"){if(e.debugMode){this.debugMode=e.debugMode}if(e.toJSON){this.toJSON=e.toJSON}if(e.fromJSON){this.fromJSON=e.fromJSON}}var d="rshStorageForm";var a="rshStorageField";var b=this.debugMode?historyStorage.showStyles:historyStorage.hideStyles;var f=(historyStorage.debugMode?"width: 800px;height:80px;border:1px solid black;":historyStorage.hideStyles);var c='<form id="'+d+'" style="'+b+'"><textarea id="'+a+'" style="'+f+'"></textarea></form>';document.write(c);this.storageField=document.getElementById(a);if(typeof window.opera!=="undefined"){this.storageField.focus()}},put:function(b,a){this.assertValidKey(b);if(this.hasKey(b)){this.remove(b)}this.storageHash[b]=a;this.saveHashTable()},get:function(b){this.assertValidKey(b);this.loadHashTable();var a=this.storageHash[b];if(a===undefined){a=null}return a},remove:function(a){this.assertValidKey(a);this.loadHashTable();delete this.storageHash[a];this.saveHashTable()},reset:function(){this.storageField.value="";this.storageHash={}},hasKey:function(a){this.assertValidKey(a);this.loadHashTable();return(typeof this.storageHash[a]!=="undefined")},isValidKey:function(a){return(typeof a==="string")},showStyles:"border:0;margin:0;padding:0;",hideStyles:"left:-1000px;top:-1000px;width:1px;height:1px;border:0;position:absolute;",debugMode:false,storageHash:{},hashLoaded:false,storageField:null,assertValidKey:function(a){var b=this.isValidKey(a);if(!b&&this.debugMode){throw new Error("Please provide a valid key for window.historyStorage. Invalid key = "+a+".")}},loadHashTable:function(){if(!this.hashLoaded){var a=this.storageField.value;if(a!==""&&a!==null){this.storageHash=this.fromJSON(a);this.hashLoaded=true}}},saveHashTable:function(){this.loadHashTable();var a=this.toJSON(this.storageHash);this.storageField.value=a},toJSON:function(a){return a.toJSONString()},fromJSON:function(a){return a.parseJSON()}};