jQuery.extend({historyCurrentHash:undefined,historyCallback:undefined,historyIframeSrc:undefined,historyInit:function(d,c){jQuery.historyCallback=d;if(c)jQuery.historyIframeSrc=c;var a=location.hash.replace(/\?.*$/,"");jQuery.historyCurrentHash=a;if(jQuery.browser.msie){if(jQuery.historyCurrentHash=="")jQuery.historyCurrentHash="#";jQuery("body").prepend('<iframe id="jQuery_history" style="display: none;"'+(jQuery.historyIframeSrc?' src="'+jQuery.historyIframeSrc+'"':"")+"></iframe>");var e=jQuery("#jQuery_history")[0],b=e.contentWindow.document;b.open();b.close();b.location.hash=a}else if(jQuery.browser.safari){jQuery.historyBackStack=[];jQuery.historyBackStack.length=history.length;jQuery.historyForwardStack=[];jQuery.lastHistoryLength=history.length;jQuery.isFirst=true}a&&jQuery.historyCallback(a.replace(/^#/,""));setInterval(jQuery.historyCheck,100)},historyAddHistory:function(a){jQuery.historyBackStack.push(a);jQuery.historyForwardStack.length=0;this.isFirst=true},historyCheck:function(){if(jQuery.browser.msie){var e=jQuery("#jQuery_history")[0],f=e.contentDocument||e.contentWindow.document,a=f.location.hash.replace(/\?.*$/,"");if(a!=jQuery.historyCurrentHash){location.hash=a;jQuery.historyCurrentHash=a;jQuery.historyCallback(a.replace(/^#/,""))}}else if(jQuery.browser.safari){jQuery.lastHistoryLength==history.length&&jQuery.historyBackStack.length>jQuery.lastHistoryLength&&jQuery.historyBackStack.shift();if(!jQuery.dontCheck){var b=history.length-jQuery.historyBackStack.length;jQuery.lastHistoryLength=history.length;if(b){jQuery.isFirst=false;if(b<0)for(var c=0;c<Math.abs(b);c++)jQuery.historyForwardStack.unshift(jQuery.historyBackStack.pop());else for(var c=0;c<b;c++)jQuery.historyBackStack.push(jQuery.historyForwardStack.shift());var d=jQuery.historyBackStack[jQuery.historyBackStack.length-1];if(d!=undefined){jQuery.historyCurrentHash=location.hash.replace(/\?.*$/,"");jQuery.historyCallback(d)}}else if(jQuery.historyBackStack[jQuery.historyBackStack.length-1]==undefined&&!jQuery.isFirst){if(location.hash){var a=location.hash;jQuery.historyCallback(location.hash.replace(/^#/,""))}else{var a="";jQuery.historyCallback("")}jQuery.isFirst=true}}}else{var a=location.hash.replace(/\?.*$/,"");if(a!=jQuery.historyCurrentHash){jQuery.historyCurrentHash=a;jQuery.historyCallback(a.replace(/^#/,""))}}},historyLoad:function(a){var b;a=decodeURIComponent(a.replace(/\?.*$/,""));if(jQuery.browser.safari)b=a;else{b="#"+a;location.hash=b}jQuery.historyCurrentHash=b;if(jQuery.browser.msie){var d=jQuery("#jQuery_history")[0],c=d.contentWindow.document;c.open();c.close();c.location.hash=b;jQuery.lastHistoryLength=history.length;jQuery.historyCallback(a)}else if(jQuery.browser.safari){jQuery.dontCheck=true;this.historyAddHistory(a);var e=function(){jQuery.dontCheck=false};window.setTimeout(e,200);jQuery.historyCallback(a);location.hash=b}else jQuery.historyCallback(a)}});
