(function ($, window, undefined){
'$:nomunge';
var str_hashchange = 'hashchange', doc = document, fake_onhashchange, special = $.event.special, doc_mode = doc.documentMode, supports_onhashchange = 'on' + str_hashchange in window && (doc_mode === undefined || doc_mode > 7);
function get_fragment(url){
url = url || _AN_Read_href('href', _AN_Read_location('location', window));
return '#' + _AN_Call_replace('replace', url, /^[^#]*#?(.*)$/, '$1');
}
;
$.fn[str_hashchange] = function (fn){
return fn? this.bind(str_hashchange, fn): this.trigger(str_hashchange);
}
;
$.fn[str_hashchange].delay = 50;
special[str_hashchange] = $.extend(special[str_hashchange], {
setup: function (){
if (supports_onhashchange) {
return false ;
}
$(fake_onhashchange.start);
}
,
teardown: function (){
if (supports_onhashchange) {
return false ;
}
$(fake_onhashchange.stop);
}
}
);
fake_onhashchange = (function (){
var self = {
}
, timeout_id, last_hash = get_fragment(), fn_retval = function (val){
return val;
}
, history_set = fn_retval, history_get = fn_retval;
self.start = function (){
timeout_id || poll();
}
;
self.stop = function (){
timeout_id && clearTimeout(timeout_id);
timeout_id = undefined;
}
;
function poll(){
var hash = get_fragment(), history_hash = history_get(last_hash);
if (hash !== last_hash) {
history_set(last_hash = hash, history_hash);
$(window).trigger(str_hashchange);
}
else if (history_hash !== last_hash) {
_AN_Write_href('href', _AN_Read_location('location', window), false , _AN_Call_replace('replace', _AN_Read_href('href', _AN_Read_location('location', window)), /#.*/, '') + history_hash);
}
timeout_id = _AN_Call_settimeout('setTimeout', window, poll, $.fn[str_hashchange].delay);
}
;
$.browser.msie && !supports_onhashchange && (function (){
var iframe, iframe_src;
self.start = function (){
if (!iframe) {
iframe_src = _AN_Read_src('src', $.fn[str_hashchange]);
iframe_src = iframe_src && iframe_src + get_fragment();
iframe = $('').hide().one('load', function (){
iframe_src || history_set(get_fragment());
poll();
}
).attr('src', iframe_src || 'javascript:0').insertAfter('body')[0].contentWindow;
doc.onpropertychange = function (){
try {
if (event.propertyName === 'title') {
iframe.document.title = doc.title;
}
}
catch (e) {
}
}
;
}
}
;
self.stop = fn_retval;
history_get = function (){
return get_fragment(_AN_Read_href('href', _AN_Read_location('location', iframe)));
}
;
history_set = function (hash, history_hash){
var iframe_doc = iframe.document, domain = _AN_Read_domain('domain', $.fn[str_hashchange]);
if (hash !== history_hash) {
iframe_doc.title = doc.title;
_AN_Call_open('open', iframe_doc);
domain && _AN_Call_write('write', iframe_doc, '');
iframe_doc.close();
_AN_Write_hash('hash', _AN_Read_location('location', iframe), false , hash);
}
}
;
}
)();
return self;
}
)();
}
)(jQuery, this);