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(a,b){var c=this;var d=function(){if(c.currentWaitTime>0)c.currentWaitTime=c.currentWaitTime-c.WAIT_TIME;a=c.removeHash(a);var d=document.getElementById(a);if(d!=undefined||d!=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: "+a;throw e}historyStorage.put(a,b);c.ignoreLocationChange=true;this.ieAtomicLocationChange=true;c.currentLocation=a;window.location.hash=a;if(c.isInternetExplorer())c.iframe.src="/blank.html?"+a;this.ieAtomicLocationChange=false};window.setTimeout(d,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);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 b=a.contentWindow.document;var c=new String(b.location.search);if(c.length==1&&c.charAt(0)=="?")c="";else if(c.length>=2&&c.charAt(0)=="?")c=c.substring(1);return c},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 a="position: absolute; top: -1000px; left: -1000px;";if(this.debugging==true){a="width: 30em; height: 30em;"}var b="<form id='historyStorageForm' "+"method='GET' "+"style='"+a+"'>"+"<textarea id='historyStorageField' "+"style='"+a+"'"+"left: -1000px;' "+"name='historyStorageField'></textarea>"+"</form>";document.write(b);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 b,c,d,e="",f;switch(typeof a){case"object":if(a){if(a.______array=="______array"){for(c=0;c<a.length;++c){f=this.stringify(a[c]);if(e){e+=","}e+=f}return"["+e+"]"}else if(typeof a.toString!="undefined"){for(c in a){f=a[c];if(typeof f!="undefined"&&typeof f!="function"){f=this.stringify(f);if(e){e+=","}e+=this.stringify(c)+":"+f}}return"{"+e+"}"}}return"null";case"number":return isFinite(a)?String(a):"null";case"string":d=a.length;e='"';for(c=0;c<d;c+=1){b=a.charAt(c);if(b>=" "){if(b=="\\"||b=='"'){e+="\\"}e+=b}else{switch(b){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:b=b.charCodeAt();e+="\\u00"+Math.floor(b/16).toString(16)+(b%16).toString(16)}}}return e+'"';case"boolean":return String(a);default:return"null"}},parse:function(a){function l(){f();switch(c){case"{":return i();case"[":return h();case'"':return g();case"-":return j();default:return c>="0"&&c<="9"?j():k()}}function k(){switch(c){case"t":if(e()=="r"&&e()=="u"&&e()=="e"){e();return true}break;case"f":if(e()=="a"&&e()=="l"&&e()=="s"&&e()=="e"){e();return false}break;case"n":if(e()=="u"&&e()=="l"&&e()=="l"){e();return null}break}d("Syntax error")}function j(){var a="",b;if(c=="-"){a="-";e()}while(c>="0"&&c<="9"){a+=c;e()}if(c=="."){a+=".";while(e()&&c>="0"&&c<="9"){a+=c}}if(c=="e"||c=="E"){a+="e";e();if(c=="-"||c=="+"){a+=c;e()}while(c>="0"&&c<="9"){a+=c;e()}}b=+a;if(!isFinite(b)){d("Bad number")}else{return b}}function i(){var a,b={};if(c=="{"){e();f();if(c=="}"){e();return b}while(c){a=g();f();if(c!=":"){break}e();b[a]=l();f();if(c=="}"){e();return b}else if(c!=","){break}e();f()}}d("Bad object")}function h(){var a=[];if(c=="["){e();f();if(c=="]"){e();return a}while(c){a.push(l());f();if(c=="]"){e();return a}else if(c!=","){break}e();f()}}d("Bad array")}function g(){var a,b="",f,g;if(c=='"'){outer:while(e()){if(c=='"'){e();return b}else if(c=="\\"){switch(e()){case"b":b+="\b";break;case"f":b+="\f";break;case"n":b+="\n";break;case"r":b+="\r";break;case"t":b+="\t";break;case"u":g=0;for(a=0;a<4;a+=1){f=parseInt(e(),16);if(!isFinite(f)){break outer}g=g*16+f}b+=String.fromCharCode(g);break;default:b+=c}}else{b+=c}}}d("Bad string")}function f(){while(c!=""&&c<=" "){e()}}function e(){c=a.charAt(b);b+=1;return c}function d(c){throw{name:"JSONError",message:c,at:b-1,text:a}}var b=0;var c=" ";return l()}};window.historyStorage.init();window.dhtmlHistory.create()

