
(function($){$.ui=$.ui||{};$.ui.hmanager=new function(){var states={},def=function(){};var $window=$(window),hash=location.hash;function getState(){return hash.replace('#','');}
var iframe;return{enable:function(){if($.browser.msie&&parseInt($.browser.version)<8){$(function(){iframe=$('<iframe id="ui-history-iframe" style="display: none;"></iframe>').prependTo(document.body)[0];iframe.contentWindow.document.open();iframe.contentWindow.document.close();if(getState())
iframe.contentWindow.document.location.hash=getState();});}
$window.bind('hashchange',function(e){if(!iframe&&hash==location.hash||iframe&&hash==iframe.contentWindow.document.location.hash)
return false;if($.browser.msie&&parseInt($.browser.version)<8){hash=iframe.contentWindow.document.location.hash;}
else
hash=location.hash;if(getState())
states[getState()]();else;});if(!($.browser.msie&&parseInt($.browser.version)>=8)){setInterval(($.browser.msie?function(){if(hash!=iframe.contentWindow.document.location.hash)
$window.trigger('hashchange');}:function(){if(hash!=location.hash)
$window.trigger('hashchange');else;}),200);}},add:function(state,handler){states[state]=handler;},go:function(state){if(state){if($.browser.msie&&parseInt($.browser.version)<8){iframe.contentWindow.document.open();iframe.contentWindow.document.close();iframe.contentWindow.document.location.hash=state;}
location.hash=state;$window.trigger('hashchange');}
else
console.log('TODO do default state');}}};$.ui.history=function(){var args=Array.prototype.slice.call(arguments,1);$.ui.hmanager[arguments[0]].apply($.ui.hmanager,args);};})(jQuery);
