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(_1){
this.listener=_1;
if(this.fireOnNewListener==true){
this.fireHistoryEvent(this.currentLocation);
this.fireOnNewListener=false;
}
},add:function(_2,_3){
var _4=this;
var _5=function(){
if(_4.currentWaitTime>0){
_4.currentWaitTime=_4.currentWaitTime-_4.WAIT_TIME;
}
_2=_4.removeHash(_2);
var _6=document.getElementById(_2);
if(_6!=undefined||_6!=null){
var _7="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: "+_2;
throw _7;
}
historyStorage.put(_2,_3);
_4.ignoreLocationChange=true;
this.ieAtomicLocationChange=true;
_4.currentLocation=_2;
window.location.hash=_2;
if(_4.isInternetExplorer()){
_4.iframe.src="blank.html?"+_2;
}
this.ieAtomicLocationChange=false;
};
window.setTimeout(_5,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 _8=this.removeHash(window.location.hash);
return _8;
},currentLocation:null,listener:null,iframe:null,ignoreLocationChange:null,WAIT_TIME:200,currentWaitTime:0,fireOnNewListener:null,firstLoad:null,ieAtomicLocationChange:null,create:function(){
var _9=this.getCurrentLocation();
this.currentLocation=_9;
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?"+_9+"'>"+"</iframe>");
this.WAIT_TIME=400;
}
var _a=this;
window.onunload=function(){
_a.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 _a=this;
var _b=function(){
_a.checkLocation();
};
setInterval(_b,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 _e=this.getCurrentLocation();
if(_e==this.currentLocation){
return;
}
this.ieAtomicLocationChange=true;
if(this.isInternetExplorer()&&this.getIFrameHash()!=_e){
this.iframe.src="blank.html?"+_e;
}else{
if(this.isInternetExplorer()){
return;
}
}
this.currentLocation=_e;
this.ieAtomicLocationChange=false;
this.fireHistoryEvent(_e);
},getIFrameHash:function(){
var _f=document.getElementById("DhtmlHistoryFrame");
var doc=_f.contentWindow.document;
var _11=new String(doc.location.search);
if(_11.length==1&&_11.charAt(0)=="?"){
_11="";
}else{
if(_11.length>=2&&_11.charAt(0)=="?"){
_11=_11.substring(1);
}
}
return _11;
},removeHash:function(_12){
if(_12==null||_12==undefined){
return null;
}else{
if(_12==""){
return "";
}else{
if(_12.length==1&&_12.charAt(0)=="#"){
return "";
}else{
if(_12.length>1&&_12.charAt(0)=="#"){
return _12.substring(1);
}else{
return _12;
}
}
}
}
},iframeLoaded:function(_13){
if(this.ignoreLocationChange==true){
this.ignoreLocationChange=false;
return;
}
var _14=new String(_13.search);
if(_14.length==1&&_14.charAt(0)=="?"){
_14="";
}else{
if(_14.length>=2&&_14.charAt(0)=="?"){
_14=_14.substring(1);
}
}
if(this.pageLoadEvent!=true){
window.location.hash=_14;
}
this.fireHistoryEvent(_14);
},isInternetExplorer:function(){
var _15=navigator.userAgent.toLowerCase();
if(document.all&&_15.indexOf("msie")!=-1){
return true;
}else{
return false;
}
}};
window.historyStorage={debugging:false,storageHash:new Object(),hashLoaded:false,put:function(key,_17){
this.assertValidKey(key);
if(this.hasKey(key)){
this.remove(key);
}
this.storageHash[key]=_17;
this.saveHashTable();
},get:function(key){
this.assertValidKey(key);
this.loadHashTable();
var _19=this.storageHash[key];
if(_19==undefined){
return null;
}else{
return _19;
}
},remove:function(key){
this.assertValidKey(key);
this.loadHashTable();
delete this.storageHash[key];
this.saveHashTable();
},reset:function(){
this.storageField.value="";
this.storageHash=new Object();
},hasKey:function(key){
this.assertValidKey(key);
this.loadHashTable();
if(typeof this.storageHash[key]=="undefined"){
return false;
}else{
return true;
}
},isValidKey:function(key){
if(typeof key!="string"){
key=key.toString();
}
var _1d=/^[a-zA-Z0-9_ \!\@\#\$\%\^\&\*\(\)\+\=\:\;\,\.\/\?\|\\\~\{\}\[\]]*$/;
return _1d.test(key);
},storageField:null,init:function(){
var _1e="position: absolute; top: -1000px; left: -1000px;";
if(this.debugging==true){
_1e="width: 30em; height: 30em;";
}
var _1f="<form id='historyStorageForm' "+"method='GET' "+"style='"+_1e+"'>"+"<textarea id='historyStorageField' "+"style='"+_1e+"'"+"left: -1000px;' "+"name='historyStorageField'></textarea>"+"</form>";
document.write(_1f);
this.storageField=document.getElementById("historyStorageField");
},assertValidKey:function(key){
if(this.isValidKey(key)==false){
throw "Please provide a valid key for "+"window.historyStorage, key= "+key;
}
},loadHashTable:function(){
if(this.hashLoaded==false){
var _21=this.storageField.value;
if(_21!=""&&_21!=null){
this.storageHash=eval("("+_21+")");
}
this.hashLoaded=true;
}
},saveHashTable:function(){
this.loadHashTable();
var _22=JSON.stringify(this.storageHash);
this.storageField.value=_22;
}};
var JSON=function(){
var m={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\"":"\\\"","\\":"\\\\"},s={"boolean":function(x){
return String(x);
},number:function(x){
return isFinite(x)?String(x):"null";
},string:function(x){
if(/["\\\x00-\x1f]/.test(x)){
x=x.replace(/([\x00-\x1f\\"])/g,function(a,b){
var c=m[b];
if(c){
return c;
}
c=b.charCodeAt();
return "\\u00"+Math.floor(c/16).toString(16)+(c%16).toString(16);
});
}
return "\""+x+"\"";
},object:function(x){
if(x){
var a=[],b,f,i,l,v;
if(x instanceof Array){
a[0]="[";
l=x.length;
for(i=0;i<l;i+=1){
v=x[i];
f=s[typeof v];
if(f){
v=f(v);
if(typeof v=="string"){
if(b){
a[a.length]=",";
}
a[a.length]=v;
b=true;
}
}
}
a[a.length]="]";
}else{
if(x instanceof Object){
a[0]="{";
for(i in x){
v=x[i];
f=s[typeof v];
if(f){
v=f(v);
if(typeof v=="string"){
if(b){
a[a.length]=",";
}
a.push(s.string(i),":",v);
b=true;
}
}
}
a[a.length]="}";
}else{
return;
}
}
return a.join("");
}
return "null";
}};
return {copyright:"(c)2005 JSON.org",license:"http://www.JSON.org/license.html",stringify:function(v){
var f=s[typeof v];
if(f){
v=f(v);
if(typeof v=="string"){
return v;
}
}
return null;
},parse:function(_2e){
try{
return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(_2e.replace(/"(\\.|[^"\\])*"/g,"")))&&eval("("+_2e+")");
}
catch(e){
return false;
}
}};
}();
window.historyStorage.init();
window.dhtmlHistory.create();

