window.dhtmlHistory={isIE:false,isOpera:false,isSafari:false,isKonquerer:false,isGecko:false,isSupported:false,create:function(I){var C=this;window.historyStorage.setup(I);if(I&&I.baseTitle){if(I.baseTitle.indexOf("@@@")<0&&historyStorage.debugMode){throw new Error("Programmer error: options.baseTitle must contain the replacement parameter '@@@' to be useful.")}this.baseTitle=I.baseTitle}var D=navigator.userAgent.toLowerCase();var A=navigator.platform.toLowerCase();var E=navigator.vendor||"";if(E==="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(E.indexOf("Apple Computer, Inc.")>-1){this.isSafari=true;this.isSupported=(A.indexOf("mac")>-1)}else{if(D.indexOf("gecko")!=-1){this.isGecko=true;this.isSupported=true}}}}}if(this.isSafari){this.createSafari()}else{if(this.isOpera){this.createOpera()}}var B=this.getCurrentLocation();this.currentLocation=B;if(this.isIE){if(I&&I.blankURL){var F=I.blankURL;this.blankURL=(F.indexOf("?")!=F.length-1?F+"?":F)}this.createIE(B)}var H=function(){C.firstLoad=null};this.addEventListener(window,"unload",H);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.firstLoad=false;this.fireOnNewListener=true}}var G=function(){C.checkLocation()};setInterval(G,100)},initialize:function(A){this.originalTitle=document.title;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}}if(A){this.addListener(A)}},addListener:function(A){this.listener=A;if(this.fireOnNewListener){this.fireHistoryEvent(this.currentLocation);this.fireOnNewListener=false}},changeTitle:function(D){var B=(D&&D.newTitle?this.baseTitle.replace("@@@",D.newTitle):this.originalTitle);if(document.title==B){return}document.title=B;if(this.isIE){this.iframe.contentWindow.document.title=B}if(!this.isIE&&!this.isOpera){var C=decodeURIComponent(document.location.hash);if(C!=""){var A=encodeURIComponent(this.removeHash(C));document.location.hash=A}else{}}},add:function(D,E){var C=this;var A=encodeURIComponent(this.removeHash(D));if(this.isSafari){historyStorage.put(D,E);this.currentLocation=A;window.location.hash=A;this.putSafariState(A);this.changeTitle(E)}else{var B=function(){if(C.currentWaitTime>0){C.currentWaitTime=C.currentWaitTime-C.waitTime}if(document.getElementById(A)&&C.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,E);C.ignoreLocationChange=true;C.ieAtomicLocationChange=true;C.currentLocation=A;window.location.hash=A;if(C.isIE){C.iframe.src=C.blankURL+A}C.ieAtomicLocationChange=false;C.changeTitle(E)};window.setTimeout(B,this.currentWaitTime);this.currentWaitTime=this.currentWaitTime+this.waitTime}},isFirstLoad:function(){return this.firstLoad},getVersion:function(){return this.VERSIONNUMBER},PAGELOADEDSTRING:"DhtmlHistory_pageLoaded",VERSIONNUMBER:"0.8",baseTitle:"@@@",originalTitle:null,blankURL:"blank.html?",listener:null,waitTime:200,currentWaitTime:0,currentLocation:null,iframe:null,safariHistoryStartPoint:null,safariStack:null,safariLength:null,ignoreLocationChange:null,fireOnNewListener:null,firstLoad:null,ieAtomicLocationChange:null,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)})}}},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="'+this.blankURL+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 D="rshSafariForm";var C="rshSafariStack";var B="rshSafariLength";var A=historyStorage.debugMode?historyStorage.showStyles:historyStorage.hideStyles;var G=(historyStorage.debugMode?"width: 800px;height:80px;border:1px solid black;":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="'+A+'"><textarea style="'+G+'" id="'+C+'">[]</textarea><input type="text" style="'+F+'" id="'+B+'" value=""/></form>';document.write(E);this.safariStack=document.getElementById(C);this.safariLength=document.getElementById(B);if(!historyStorage.hasKey(this.PAGELOADEDSTRING)){this.safariHistoryStartPoint=history.length;this.safariLength.value=this.safariHistoryStartPoint}else{this.safariHistoryStartPoint=this.safariLength.value}},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):"")},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=decodeURIComponent(B);var C=historyStorage.get(A);this.changeTitle(C);this.listener.call(null,A,C)},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=this.blankURL+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+'"><input type="text" id="'+F+'" style="'+E+'"/></form>';document.write(C);this.storageField=document.getElementById(F);if(typeof window.opera!=="undefined"){this.storageField.focus()}},put:function(A,C){var B=encodeURIComponent(A);this.assertValidKey(B);if(this.hasKey(A)){this.remove(A)}this.storageHash[B]=C;this.saveHashTable()},get:function(A){var C=encodeURIComponent(A);this.assertValidKey(C);this.loadHashTable();var B=this.storageHash[C];if(B===undefined){B=null}return B},remove:function(A){var B=encodeURIComponent(A);this.assertValidKey(B);this.loadHashTable();delete this.storageHash[B];this.saveHashTable()},reset:function(){this.storageField.value="";this.storageHash={}},hasKey:function(A){var B=encodeURIComponent(A);this.assertValidKey(B);this.loadHashTable();return(typeof this.storageHash[B]!=="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()}};