(function(a){function e(){this._curHash="";this._callback=function(){}}a.extend(e.prototype,{init:function(b){this._callback=b;this._curHash=location.hash;if(a.browser.msie){if(this._curHash=="")this._curHash="#";a("body").prepend('<iframe id="jQuery_history" style="display: none;"></iframe>');b=a("#jQuery_history")[0].contentWindow.document;b.open();b.close();b.location.hash=this._curHash}else if(a.browser.safari){this._historyBackStack=[];this._historyBackStack.length=history.length;this._historyForwardStack= [];this._isFirst=true;this._dontCheck=false}this._callback(this._curHash.replace(/^#/,""));setInterval(this._check,100)},add:function(b){this._historyBackStack.push(b);this._historyForwardStack.length=0;this._isFirst=true},_check:function(){if(a.browser.msie){var b=a("#jQuery_history")[0];b=b.contentDocument||b.contentWindow.document;b=b.location.hash;if(b!=a.history._curHash){location.hash=b;a.history._curHash=b;a.history._callback(b.replace(/^#/,""))}}else if(a.browser.safari){if(!a.history._dontCheck)if(b= history.length-a.history._historyBackStack.length){a.history._isFirst=false;if(b<0)for(var c=0;c<Math.abs(b);c++)a.history._historyForwardStack.unshift(a.history._historyBackStack.pop());else for(c=0;c<b;c++)a.history._historyBackStack.push(a.history._historyForwardStack.shift());b=a.history._historyBackStack[a.history._historyBackStack.length-1];if(b!=undefined){a.history._curHash=location.hash;a.history._callback(b)}}else if(a.history._historyBackStack[a.history._historyBackStack.length-1]==undefined&& !a.history._isFirst){document.URL.indexOf("#")>=0?a.history._callback(document.URL.split("#")[1]):a.history._callback("");a.history._isFirst=true}}else{b=location.hash;if(b!=a.history._curHash){a.history._curHash=b;a.history._callback(b.replace(/^#/,""))}}},load:function(b){var c;if(a.browser.safari)c=b;else{c="#"+b;location.hash=c}this._curHash=c;if(a.browser.msie){var d=a("#jQuery_history")[0];d=d.contentWindow.document;d.open();d.close();d.location.hash=c;this._callback(b)}else if(a.browser.safari){this._dontCheck= true;this.add(b);d=function(){a.history._dontCheck=false};window.setTimeout(d,200);this._callback(b);location.hash=c}else this._callback(b)}});a(document).ready(function(){a.history=new e})})(jQuery);