window.dhtmlHistory={initialize:function(){if(this.isInternetExplorer()==false){return ;}if(historyStorage.hasKey("DhtmlHistory_pageLoaded")==false){this.fireOnNewListener=false;this.firstLoad=true;historyStorage.put("DhtmlHistory_pageLoaded",true);}else{this.fireOnNewListener=true;this.firstLoad=false;}},addListener:function(A){this.listener=A;if(this.fireOnNewListener==true){this.fireHistoryEvent(this.currentLocation);this.fireOnNewListener=false;}},add:function(C,D){var A=this;var B=function(){if(A.currentWaitTime>0){A.currentWaitTime=A.currentWaitTime-A.WAIT_TIME;}C=A.removeHash(C);var F=document.getElementById(C);if(F!=undefined||F!=null){var E="Exception: History locations can not have the same value as _any_ id's that might be in the document, due to a bug in Internet Explorer; please ask the developer to choose a history location that does not match any HTML id's in this document. The following ID is already taken and can not be a location: "+C;throw E;}historyStorage.put(C,D);A.ignoreLocationChange=true;this.ieAtomicLocationChange=true;A.currentLocation=C;window.location.hash=C;if(A.isInternetExplorer()){A.iframe.src="blank.html?"+C;}this.ieAtomicLocationChange=false;};window.setTimeout(B,this.currentWaitTime);this.currentWaitTime=this.currentWaitTime+this.WAIT_TIME;},isFirstLoad:function(){if(this.firstLoad==true){return true;}else{return false;}},isInternational:function(){return false;},getVersion:function(){return"0.03";},getCurrentLocation:function(){var A=this.removeHash(window.location.hash);return A;},currentLocation:null,listener:null,iframe:null,ignoreLocationChange:null,WAIT_TIME:200,currentWaitTime:0,fireOnNewListener:null,firstLoad:null,ieAtomicLocationChange:null,create:function(){var A=this.getCurrentLocation();this.currentLocation=A;if(this.isInternetExplorer()){document.write("<iframe style='border: 0px; width: 1px; height: 1px; position: absolute; bottom: 0px; right: 0px; visibility: visible;' name='DhtmlHistoryFrame' id='DhtmlHistoryFrame' src='blank.html?"+A+"'></iframe>");this.WAIT_TIME=400;}var B=this;window.onunload=function(){B.firstLoad=null;};if(this.isInternetExplorer()==false){if(historyStorage.hasKey("DhtmlHistory_pageLoaded")==false){this.ignoreLocationChange=true;this.firstLoad=true;historyStorage.put("DhtmlHistory_pageLoaded",true);}else{this.ignoreLocationChange=false;this.fireOnNewListener=true;}}else{this.ignoreLocationChange=true;}if(this.isInternetExplorer()){this.iframe=document.getElementById("DhtmlHistoryFrame");}var B=this;var C=function(){B.checkLocation();};setInterval(C,100);},fireHistoryEvent:function(A){var B=historyStorage.get(A);if(this.listener!=null){this.listener.call(null,A,B);}},checkLocation:function(){if(this.isInternetExplorer()==false&&this.ignoreLocationChange==true){this.ignoreLocationChange=false;return ;}if(this.isInternetExplorer()==false&&this.ieAtomicLocationChange==true){return ;}var A=this.getCurrentLocation();if(A==this.currentLocation){return ;}this.ieAtomicLocationChange=true;if(this.isInternetExplorer()&&this.getIFrameHash()!=A){this.iframe.src="blank.html?"+A;}else{if(this.isInternetExplorer()){return ;}}this.currentLocation=A;this.ieAtomicLocationChange=false;this.fireHistoryEvent(A);},getIFrameHash:function(){var A=document.getElementById("DhtmlHistoryFrame");var C=A.contentWindow.document;var B=new String(C.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(A){if(A==null||A==undefined){return null;}else{if(A==""){return"";}else{if(A.length==1&&A.charAt(0)=="#"){return"";}else{if(A.length>1&&A.charAt(0)=="#"){return A.substring(1);}else{return A;}}}}},iframeLoaded:function(A){if(this.ignoreLocationChange==true){this.ignoreLocationChange=false;return ;}var B=new String(A.search);if(B.length==1&&B.charAt(0)=="?"){B="";}else{if(B.length>=2&&B.charAt(0)=="?"){B=B.substring(1);}}if(this.pageLoadEvent!=true){window.location.hash=B;}this.fireHistoryEvent(B);},isInternetExplorer:function(){var A=navigator.userAgent.toLowerCase();if(document.all&&A.indexOf("msie")!=-1){return true;}else{return false;}}};window.historyStorage={debugging:false,storageHash:new Object(),hashLoaded:false,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){return null;}else{return B;}},remove:function(A){this.assertValidKey(A);this.loadHashTable();delete this.storageHash[A];this.saveHashTable();},reset:function(){this.storageField.value="";this.storageHash=new Object();},hasKey:function(A){this.assertValidKey(A);this.loadHashTable();if(typeof this.storageHash[A]=="undefined"){return false;}else{return true;}},isValidKey:function(A){if(typeof A!="string"){A=A.toString();}var B=/^[a-zA-Z0-9_ \!\@\#\$\%\^\&\*\(\)\+\=\:\;\,\.\/\?\|\\\~\{\}\[\]]*$/;return B.test(A);},storageField:null,init:function(){var B="position: absolute; top: -1000px; left: -1000px;";if(this.debugging==true){B="width: 30em; height: 30em;";}var A="<div style='"+B+"'><form id='historyStorageForm' method='GET' ><textarea id='historyStorageField' name='historyStorageField'></textarea></form></div>";document.write(A);this.storageField=document.getElementById("historyStorageField");},assertValidKey:function(A){if(this.isValidKey(A)==false){throw"Please provide a valid key for window.historyStorage, key= "+A;}},loadHashTable:function(){if(this.hashLoaded==false){var serializedHashTable=this.storageField.value;if(serializedHashTable!=""&&serializedHashTable!=null){this.storageHash=eval("("+serializedHashTable+")");}this.hashLoaded=true;}},saveHashTable:function(){this.loadHashTable();var A=JSON.stringify(this.storageHash);this.storageField.value=A;}};Array.prototype.______array="______array";var JSON={org:"http://www.JSON.org",copyright:"(c)2005 JSON.org",license:"http://www.crockford.com/JSON/license.html",stringify:function(A){var F,D,B,E="",C;switch(typeof A){case"object":if(A){if(A.______array=="______array"){for(D=0;D<A.length;++D){C=this.stringify(A[D]);if(E){E+=",";}E+=C;}return"["+E+"]";}else{if(typeof A.toString!="undefined"){for(D in A){C=A[D];if(typeof C!="undefined"&&typeof C!="function"){C=this.stringify(C);if(E){E+=",";}E+=this.stringify(D)+":"+C;}}return"{"+E+"}";}}}return"null";case"number":return isFinite(A)?String(A):"null";case"string":B=A.length;E='"';for(D=0;D<B;D+=1){F=A.charAt(D);if(F>=" "){if(F=="\\"||F=='"'){E+="\\";}E+=F;}else{switch(F){case"\b":E+="\\b";break;case"\f":E+="\\f";break;case"\n":E+="\\n";break;case"\r":E+="\\r";break;case"\t":E+="\\t";break;default:F=F.charCodeAt();E+="\\u00"+Math.floor(F/16).toString(16)+(F%16).toString(16);}}}return E+'"';case"boolean":return String(A);default:return"null";}},parse:function(L){var D=0;var A=" ";function K(M){throw {name:"JSONError",message:M,at:D-1,text:L};}function G(){A=L.charAt(D);D+=1;return A;}function I(){while(A!=""&&A<=" "){G();}}function J(){var O,P="",N,M;if(A=='"'){outer:while(G()){if(A=='"'){G();return P;}else{if(A=="\\"){switch(G()){case"b":P+="\b";break;case"f":P+="\f";break;case"n":P+="\n";break;case"r":P+="\r";break;case"t":P+="\t";break;case"u":M=0;for(O=0;O<4;O+=1){N=parseInt(G(),16);if(!isFinite(N)){break outer;}M=M*16+N;}P+=String.fromCharCode(M);break;default:P+=A;}}else{P+=A;}}}}K("Bad string");}function H(){var M=[];if(A=="["){G();I();if(A=="]"){G();return M;}while(A){M.push(C());I();if(A=="]"){G();return M;}else{if(A!=","){break;}}G();I();}}K("Bad array");}function E(){var M,N={};if(A=="{"){G();I();if(A=="}"){G();return N;}while(A){M=J();I();if(A!=":"){break;}G();N[M]=C();I();if(A=="}"){G();return N;}else{if(A!=","){break;}}G();I();}}K("Bad object");}function F(){var N="",M;if(A=="-"){N="-";G();}while(A>="0"&&A<="9"){N+=A;G();}if(A=="."){N+=".";while(G()&&A>="0"&&A<="9"){N+=A;}}if(A=="e"||A=="E"){N+="e";G();if(A=="-"||A=="+"){N+=A;G();}while(A>="0"&&A<="9"){N+=A;G();}}M=+N;if(!isFinite(M)){K("Bad number");}else{return M;}}function B(){switch(A){case"t":if(G()=="r"&&G()=="u"&&G()=="e"){G();return true;}break;case"f":if(G()=="a"&&G()=="l"&&G()=="s"&&G()=="e"){G();return false;}break;case"n":if(G()=="u"&&G()=="l"&&G()=="l"){G();return null;}break;}K("Syntax error");}function C(){I();switch(A){case"{":return E();case"[":return H();case'"':return J();case"-":return F();default:return A>="0"&&A<="9"?F():B();}}return C();}};window.historyStorage.init();window.dhtmlHistory.create();