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