window.dhtmlHistory={isIE:false,isOpera:false,isSafari:false,isKonquerer:false,isGecko:false,isSupported:false,create:function(H){var G=this;var F=navigator.userAgent.toLowerCase();var E=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=(E.indexOf("mac")>-1)}else{if(F.indexOf("gecko")!=-1){this.isGecko=true;this.isSupported=true}}}}}window.historyStorage.setup(H);if(this.isSafari){this.createSafari()}else{if(this.isOpera){this.createOpera()}}var C=this.getCurrentLocation();this.currentLocation=C;if(this.isIE){this.createIE(C)}var B=function(){G.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 A=function(){G.checkLocation()};setInterval(A,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(C,B,A){if(C.addEventListener){C.addEventListener(B,A,false)}else{if(C.attachEvent){C.attachEvent("on"+B,function(){A(window.event)})}}},add:function(B,A){if(this.isSafari){B=this.removeHash(B);historyStorage.put(B,A);this.currentLocation=B;window.location.hash=B;this.putSafariState(B)}else{var D=this;var C=function(){if(D.currentWaitTime>0){D.currentWaitTime=D.currentWaitTime-D.waitTime}B=D.removeHash(B);if(document.getElementById(B)&&D.debugMode){var E="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: "+B;throw new Error(E)}historyStorage.put(B,A);D.ignoreLocationChange=true;D.ieAtomicLocationChange=true;D.currentLocation=B;window.location.hash=B;if(D.isIE){D.iframe.src="blank.html?"+B}D.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 B=window.location.href;var A=B.indexOf("#");return(A>=0?B.substr(A+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(D){this.waitTime=400;var C=(historyStorage.debugMode?"width: 800px;height:80px;border:1px solid black;":historyStorage.hideStyles);var B="rshHistoryFrame";var A='<iframe frameborder="0" id="'+B+'" style="'+C+'" src="blank.html?'+D+'"></iframe>';document.write(A);this.iframe=document.getElementById(B)},createOpera:function(){this.waitTime=400;var A='<img src="javascript:location.href=\'javascript:dhtmlHistory.checkLocation();\';" style="'+historyStorage.hideStyles+'" />';document.write(A)},createSafari:function(){var F="rshSafariForm";var E="rshSafariStack";var D="rshSafariLength";var C=historyStorage.debugMode?historyStorage.showStyles:historyStorage.hideStyles;var B=(historyStorage.debugMode?"width:800px;height:20px;border:1px solid black;margin:0;padding:0;":historyStorage.hideStyles);var A='<form id="'+F+'" style="'+C+'"><input type="text" style="'+B+'" id="'+E+'" value="[]"/><input type="text" style="'+B+'" id="'+D+'" value=""/></form>';document.write(A);this.safariStack=document.getElementById(E);this.safariLength=document.getElementById(D);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 A=this.getSafariStack();var B=A[history.length-this.safariHistoryStartPoint-1];return B},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 B=this.iframe.contentWindow.document;var A=String(B.location.search);if(A.length==1&&A.charAt(0)=="?"){A=""}else{if(A.length>=2&&A.charAt(0)=="?"){A=A.substring(1)}}return A},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(F){if(typeof F!=="undefined"){if(F.debugMode){this.debugMode=F.debugMode}if(F.toJSON){this.toJSON=F.toJSON}if(F.fromJSON){this.fromJSON=F.fromJSON}}var D="rshStorageForm";var E="rshStorageField";var C=this.debugMode?historyStorage.showStyles:historyStorage.hideStyles;var B=(historyStorage.debugMode?"width: 800px;height:80px;border:1px solid black;":historyStorage.hideStyles);var A='<form id="'+D+'" style="'+C+'"><textarea id="'+E+'" style="'+B+'"></textarea></form>';document.write(A);this.storageField=document.getElementById(E);if(typeof window.opera!=="undefined"){this.storageField.focus()}},put:function(A,B){this.assertValidKey(A);if(this.hasKey(A)){this.remove(A)}this.storageHash[A]=B;this.saveHashTable()},get:function(A){this.assertValidKey(A);this.loadHashTable();var B=this.storageHash[A];if(B===undefined){B=null}return B},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()}};