var blankPath=ImgPath;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(B){this.listener=B;if(this.fireOnNewListener==true){this.fireHistoryEvent(this.currentLocation);this.fireOnNewListener=false}},add:function(G,F){var E=this;var H=function(){if(E.currentWaitTime>0){E.currentWaitTime=E.currentWaitTime-E.WAIT_TIME}G=E.removeHash(G);var A=document.getElementById(G);if(A!=undefined||A!=null){var B="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: "+G;throw B}historyStorage.put(G,F);E.ignoreLocationChange=true;this.ieAtomicLocationChange=true;E.currentLocation=G;window.location.hash=G;if(E.isInternetExplorer()){E.iframe.src=blankPath+"/blank.aspx?"+G}this.ieAtomicLocationChange=false};window.setTimeout(H,this.currentWaitTime);this.currentWaitTime=this.currentWaitTime+this.WAIT_TIME},isFirstLoad:function(){if(this.firstLoad==true){return true}else{return false}},setBlankHTMLPath:function(B){blankPath=B},isInternational:function(){return false},getVersion:function(){return"0.03"},getCurrentLocation:function(){var B=this.removeHash(window.location.hash);return B},currentLocation:null,listener:null,iframe:null,ignoreLocationChange:null,WAIT_TIME:200,currentWaitTime:0,fireOnNewListener:null,firstLoad:null,ieAtomicLocationChange:null,create:function(){var D=this.getCurrentLocation();this.currentLocation=D;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='"+blankPath+"/blank.aspx?"+D+"'></iframe>");this.WAIT_TIME=400}var F=this;window.onunload=function(){F.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 F=this;var E=function(){F.checkLocation()};setInterval(E,100)},fireHistoryEvent:function(C){var D=historyStorage.get(C);this.listener.call(null,C,D)},checkLocation:function(){if(this.isInternetExplorer()==false&&this.ignoreLocationChange==true){this.ignoreLocationChange=false;return }if(this.isInternetExplorer()==false&&this.ieAtomicLocationChange==true){return }var B=this.getCurrentLocation();if(B==this.currentLocation){return }this.ieAtomicLocationChange=true;if(this.isInternetExplorer()&&this.getIFrameHash()!=B){this.iframe.src=this.blankPath+"/blank.aspx?"+B}else{if(this.isInternetExplorer()){return }}this.currentLocation=B;this.ieAtomicLocationChange=false;this.fireHistoryEvent(B)},getIFrameHash:function(){var D=document.getElementById("DhtmlHistoryFrame");var E=D.contentWindow.document;var F=new String(E.location.search);if(F.length==1&&F.charAt(0)=="?"){F=""}else{if(F.length>=2&&F.charAt(0)=="?"){F=F.substring(1)}}return F},removeHash:function(B){if(B==null||B==undefined){return null}else{if(B==""){return""}else{if(B.length==1&&B.charAt(0)=="#"){return""}else{if(B.length>1&&B.charAt(0)=="#"){return B.substring(1)}else{return B}}}}},iframeLoaded:function(C){if(this.ignoreLocationChange==true){this.ignoreLocationChange=false;return }var D=new String(C.search);if(D.length==1&&D.charAt(0)=="?"){D=""}else{if(D.length>=2&&D.charAt(0)=="?"){D=D.substring(1)}}if(this.pageLoadEvent!=true){window.location.hash=D}this.fireHistoryEvent(D)},isInternetExplorer:function(){var B=navigator.userAgent.toLowerCase();if(document.all&&B.indexOf("msie")!=-1){return true}else{return false}}};window.historyStorage={debugging:false,storageHash:new Object(),hashLoaded:false,put:function(C,D){this.assertValidKey(C);if(this.hasKey(C)){this.remove(C)}this.storageHash[C]=D;this.saveHashTable()},get:function(C){this.assertValidKey(C);this.loadHashTable();var D=this.storageHash[C];if(D==undefined){return null}else{return D}},remove:function(B){this.assertValidKey(B);this.loadHashTable();delete this.storageHash[B];this.saveHashTable()},reset:function(){this.storageField.value="";this.storageHash=new Object()},hasKey:function(B){this.assertValidKey(B);this.loadHashTable();if(typeof this.storageHash[B]=="undefined"){return false}else{return true}},isValidKey:function(C){if(typeof C!="string"){C=C.toString()}var D=/^[a-zA-Z0-9_ \!\@\#\$\%\^\&\*\(\)\+\=\:\;\,\.\/\?\|\\\~\{\}\[\]]*$/;return D.test(C)},storageField:null,init:function(){var D="position: absolute; top: -1000px; left: -1000px;";if(this.debugging==true){D="width: 30em; height: 30em;"}var C="<form id='historyStorageForm' method='GET' style='"+D+"'><textarea id='historyStorageField' style='"+D+"'left: -1000px;' name='historyStorageField'></textarea></form>";document.write(C);this.storageField=document.getElementById("historyStorageField")},assertValidKey:function(B){if(this.isValidKey(B)==false){throw"Please provide a valid key for window.historyStorage, key= "+B}},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 B=JSON.stringify(this.storageHash);this.storageField.value=B}};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(G){var H,J,L,I="",K;switch(typeof G){case"object":if(G){if(G.______array=="______array"){for(J=0;J<G.length;++J){K=this.stringify(G[J]);if(I){I+=","}I+=K}return"["+I+"]"}else{if(typeof G.toString!="undefined"){for(J in G){K=G[J];if(typeof K!="undefined"&&typeof K!="function"){K=this.stringify(K);if(I){I+=","}I+=this.stringify(J)+":"+K}}return"{"+I+"}"}}}return"null";case"number":return isFinite(G)?String(G):"null";case"string":L=G.length;I='"';for(J=0;J<L;J+=1){H=G.charAt(J);if(H>=" "){if(H=="\\"||H=='"'){I+="\\"}I+=H}else{switch(H){case"\b":I+="\\b";break;case"\f":I+="\\f";break;case"\n":I+="\\n";break;case"\r":I+="\\r";break;case"\t":I+="\\t";break;default:H=H.charCodeAt();I+="\\u00"+Math.floor(H/16).toString(16)+(H%16).toString(16)}}}return I+'"';case"boolean":return String(G);default:return"null"}},parse:function(Q){var M=0;var P=" ";function R(A){throw {name:"JSONError",message:A,at:M-1,text:Q}}function V(){P=Q.charAt(M);M+=1;return P}function T(){while(P!=""&&P<=" "){V()}}function S(){var B,A="",C,D;if(P=='"'){outer:while(V()){if(P=='"'){V();return A}else{if(P=="\\"){switch(V()){case"b":A+="\b";break;case"f":A+="\f";break;case"n":A+="\n";break;case"r":A+="\r";break;case"t":A+="\t";break;case"u":D=0;for(B=0;B<4;B+=1){C=parseInt(V(),16);if(!isFinite(C)){break outer}D=D*16+C}A+=String.fromCharCode(D);break;default:A+=P}}else{A+=P}}}}R("Bad string")}function U(){var A=[];if(P=="["){V();T();if(P=="]"){V();return A}while(P){A.push(N());T();if(P=="]"){V();return A}else{if(P!=","){break}}V();T()}}R("Bad array")}function X(){var B,A={};if(P=="{"){V();T();if(P=="}"){V();return A}while(P){B=S();T();if(P!=":"){break}V();A[B]=N();T();if(P=="}"){V();return A}else{if(P!=","){break}}V();T()}}R("Bad object")}function W(){var A="",B;if(P=="-"){A="-";V()}while(P>="0"&&P<="9"){A+=P;V()}if(P=="."){A+=".";while(V()&&P>="0"&&P<="9"){A+=P}}if(P=="e"||P=="E"){A+="e";V();if(P=="-"||P=="+"){A+=P;V()}while(P>="0"&&P<="9"){A+=P;V()}}B=+A;if(!isFinite(B)){R("Bad number")}else{return B}}function O(){switch(P){case"t":if(V()=="r"&&V()=="u"&&V()=="e"){V();return true}break;case"f":if(V()=="a"&&V()=="l"&&V()=="s"&&V()=="e"){V();return false}break;case"n":if(V()=="u"&&V()=="l"&&V()=="l"){V();return null}break}R("Syntax error")}function N(){T();switch(P){case"{":return X();case"[":return U();case'"':return S();case"-":return W();default:return P>="0"&&P<="9"?W():O()}}return N()}};window.historyStorage.init();window.dhtmlHistory.create();
