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