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