
(function($){$.extend({historyCurrentHash:undefined,historyCallback:undefined,historyInit:function(callback){$.historyCallback=callback;var current_hash=location.hash.replace(/\?.*$/,'');$.historyCurrentHash=current_hash;if(($.browser.msie)&&($.browser.version<8)){if($.historyCurrentHash==''){$.historyCurrentHash='#';}
var src="";if(current_hash&&current_hash!='#'){src=' src="'+$('base').attr('href')+'images/spacer.gif'+'"';}
$("body").prepend('<iframe id="jQuery_history" style="display: none;"'+src+'></iframe>');var ihistory=$("#jQuery_history")[0];var iframe=ihistory.contentDocument||ihistory.contentWindow.document;iframe.open();iframe.close();iframe.location.hash=current_hash;}
else if($.browser.safari){$.historyBackStack=[];$.historyBackStack.length=history.length;$.historyForwardStack=[];$.lastHistoryLength=history.length;$.isFirst=true;}
if(current_hash){$.historyCallback(current_hash.replace(/^#/,''));}
setInterval($.historyCheck,100);},historyAddHistory:function(hash){$.historyBackStack.push(hash);$.historyForwardStack.length=0;this.isFirst=true;},historyCheck:function(){if(($.browser.msie)&&($.browser.version<8)){var ihistory=$("#jQuery_history")[0];var iframe=ihistory.contentDocument||ihistory.contentWindow.document;var current_hash=iframe.location.hash.replace(/\?.*$/,'');if(current_hash!=$.historyCurrentHash){location.hash=current_hash;$.historyCurrentHash=current_hash;$.historyCallback(current_hash.replace(/^#/,''));}}else if($.browser.safari){if($.lastHistoryLength==history.length&&$.historyBackStack.length>$.lastHistoryLength){$.historyBackStack.shift();}
if(!$.dontCheck){var historyDelta=history.length-$.historyBackStack.length;$.lastHistoryLength=history.length;if(historyDelta){$.isFirst=false;if(historyDelta<0){for(var i=0;i<Math.abs(historyDelta);i++)$.historyForwardStack.unshift($.historyBackStack.pop());}else{for(var i=0;i<historyDelta;i++)$.historyBackStack.push($.historyForwardStack.shift());}
var cachedHash=$.historyBackStack[$.historyBackStack.length-1];if(cachedHash!=undefined){$.historyCurrentHash=location.hash.replace(/\?.*$/,'');$.historyCallback(cachedHash);}}else if($.historyBackStack[$.historyBackStack.length-1]==undefined&&!$.isFirst){if(location.hash){var current_hash=location.hash;$.historyCallback(location.hash.replace(/^#/,''));}else{var current_hash='';$.historyCallback('');}
$.isFirst=true;}}}else{var current_hash=location.hash.replace(/\?.*$/,'');if(current_hash!=$.historyCurrentHash){$.historyCurrentHash=current_hash;$.historyCallback(current_hash.replace(/^#/,''));}}},historyLoad:function(hash){var newhash;hash=decodeURIComponent(hash.replace(/\?.*$/,''));if($.browser.safari){newhash=hash;}else{newhash='#'+hash;location.hash=newhash;}
$.historyCurrentHash=newhash;if(($.browser.msie)&&($.browser.version<8)){var ihistory=$("#jQuery_history")[0];var iframe=ihistory.contentDocument||ihistory.contentWindow.document;iframe.open();iframe.close();iframe.location.hash=newhash;$.lastHistoryLength=history.length;$.historyCallback(hash);}else if($.browser.safari){$.dontCheck=true;this.historyAddHistory(hash);var fn=function(){$.dontCheck=false;};window.setTimeout(fn,200);$.historyCallback(hash);location.hash=newhash;}else{$.historyCallback(hash);}}});})(jQuery);